Skip to Content
avatar image
Former Member

How to use the JavaScript method - hasDataChanged() ?

Hi,

In the exit event of a field, I want to check whether the data is changed or not. I have found a method 'hasDataChanged()' in the Adobe LiveCycle Designer help, but not enough documentation is given.

I tried multiple possibilities for using that method, but I ended in error always. How can we use this method in script ?

Thanks,

Prabhakar.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Apr 15, 2009 at 04:07 PM

    Hi,

    As this method returns a boolean it might return '1' or '0'.

    So click on the field which you want to check if changed, and check if the status is '1'(changed) or else if it is '0(not changed).

    Select JavaScript Language and just check if the below code works.

    if (this.hasDataChanged() == '1')

    {

    <put your logic>

    }

    else

    {

    <put your logic>

    }

    Regards,

    Vidya Chowdhary A.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi All,

      I have managed to solve that issue, by implementing a work-around. I created another field(hidden) , theis field will have the same value as in the respective visible fields. In script, I will compare the new value(in visible field) with the old one(in corresponding hidden field) , and I will go further only when these two are different.

      As this above solution is only a work-around, I will keep this question as open.

      Best Regards,

      Prabhakar.

  • avatar image
    Former Member
    Apr 16, 2009 at 07:55 PM

    Hi Prabhakar,

    I use a following work-around:

    The enter event (javaScript):

    var myEnterRawValue=this.rawValue;

    The exit event (javaScript):

    if (myEnterRawValue!=this.rawValue) {
      // your code
    }

    Michal

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Michal,

      I tried to implement your code, but I am getting the following error in exit event.

      "myEnterRawValue is not defined".

      I used other way, I created a script object for global varibles, declared a global variable in that script object, in enter event I strored the raw value in that global variable in script object, in exit event I get the value from the script object and compare with the current value.

      In ScriptObject,

      var Value1;

      In enter event,

      <ScriptObject>.Value1 = this.rawValue;

      In Exit event,

      if(this.rawValue != <ScriptObject>.Value1 )
      {
         // Code
      }

      Thanks,

      Prabhakar.