cancel
Showing results for 
Search instead for 
Did you mean: 

How to use the JavaScript method - hasDataChanged() ?

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi Vidya,

Sorry, this code doesn't work for me. I am getting the below error.

"this.hasDataChanged is not a function"

Thanks,

Prabhakar.

Former Member
0 Kudos

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.

Answers (1)

Answers (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

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.