These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Get the previous value in a drop down list

excellionroto2
Registered: May 10 2010
Posts: 12

Hello all,

I have done an application which consists in the next information:

- A drop down list with several options.
- A text field which value is retrieved depending on the value of the drop down list.
- Apart from those fields there are a lot of text fields which have a specified format depending on the previous text field.

Now, I placed a message box and I am trying to do the next functionality:

- If I select a determined option in the drop down list, I get a message box which alerts that the rest of fields in the form are going to be reset.

xfa.host.messageBox("If you change the option...","Change",1,1);
Firstly, if I accept the message box, my purpose in successful....

If I cancel the message box I would like to see the option before change.

Is it possible to get the previous value on a drop down list if I cancel the message box (now I see the new option).

Thanks in advance.

Best regards,
Roberto

My Product Information:
LiveCycle Designer, Windows
jonom
Registered: Jan 31 2008
Posts: 133
I think xfa.event.prevText; should work for you.
TextField1.rawValue = xfa.event.prevText;
excellionroto2
Registered: May 10 2010
Posts: 12
Thank you for your response.

I placed the next code in the Exit event of the drop down list:

var vTest = xfa.host.messageBox("If you change the option...","Change",1,1);

if (vTest == "1")
{
xfa.host.resetData("CPNForm.Page1.Field1");
xfa.host.resetData("CPNForm.Page1.Field2");
xfa.host.resetData("CPNForm.Page1.Field3");
xfa.host.resetData("CPNForm.Page1.Field4");
}
else
{
CPNForm.Page1.dropdownlist.rawValue = xfa.event.prevText;
}

When I click the accept button on the drop down list, the functionality is correct...but if I press Cancel Button, the drop down option change to an empty option and my purpose is to get the same option before the change in the drop down list.

If I place an invisible field next to the drop down list in order to do that, I get the previous value changing in the drop down list with your attached code, but if I try to do it over the dorp down list, I get an empty value.

Is there any way to do that applying the code over the same field?

Thanks in advance.

Best regards,
Roberto
jonom
Registered: Jan 31 2008
Posts: 133
Not sure...maybe storing the value in a variable and restoring it manually afterward?

I haven't run into that before so I'm not sure what effect pressing cancel has on the script.
excellionroto2
Registered: May 10 2010
Posts: 12
Hello,

I stored the previous value in an invisible text field using the prevText property but I was not able to re-assign this value to the drop down list.

Is there any property or any way to assign this value to the drop down list?

Thanks in advance.

Best regards,
Roberto