Hello,
I am trying to get the previous value of a drop down list when I press cancel button of a message box. In order to do that, I placed the next code in a
Change event:
var vTest = xfa.host.messageBox("If you change the option...","Change",1,1);
if (vTest == "1")
{
xfa.host.resetData(); //If I press Accept button, all form data is reset
}
else
{
Form.Page1.dropdownlist.rawValue = xfa.event.prevText; //I am trying to re-assign the previous value to the drop down list but I am not able to do it. I am getting a blank value and I would like to get the previous value in the drop down list before pressing Cancel button.
}
After the previous explanation, I tested to store the previous values in a new field and the result was correct. 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?....or only I can get my purpose using another separate field.
Thanks in advance.
Best regards,
Roberto
Views
Replies
Total Likes
To reassign it you simply use DDListName.rawValue = StoredFieldName.rawValue
paul
Views
Replies
Total Likes
Hello Paul,
As you commented before, I tried to re-assign the previous value applying the next code:
if (vTest == "1")
{
xfa.host.resetData(); //When I press OK Button
}
else
{
DDListName.rawValue = StoredFieldName.rawValue; //When I press cancel button
}
I have done many tests and I am not able to get the previous value in the drop-down list. When I press cancel button, I see the selected value of the DDList instead the previous.
One comment:
1- In order to store the previous value, I created a text field in order to see the value (StoredFieldName is a text field). Is it necessary to create a variable in order to store the value?...or using a text field is correct.
Thanks in advance.
Best regards,
Roberto
Views
Replies
Total Likes
On which event is that code executing?
The rawValue property is not set on the change event (if that is what you are using then you will want to use xfa.event.newText = StoredFieldName.rawValue to get the value of the DD into that field).
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies