There are three values specified in a dropdown list contained in a subform. I want the dropdown value to be set, and the caption of a text field to be changed, by a script which requires the user to answer a question. The problem is with setting the value of the dropdown list itself. It does NOT change. The caption of the text field changes as expected and the message box also displays.
In the change event of the dropdown list, I have the following script:
var nButton = app.alert({cMsg: "Question",cTitle: "Question Title", nIcon: 2, nType: 3});
//if no, Change caption to "Equipment Name:" and dropdown value to 1
if (nButton == 3){
this.rawValue = 1;
InstName.caption.value.text.value = "Equipment Name: ";
xfa.host.messageBox("Message1", "Title1", 3, 1);
}
//if yes, Change caption to "Instrument Name:" and dropdown value to 2
if (nButton ==4){
this.rawValue = 2;
InstName.caption.value.text.value = "Instrument Name: ";
xfa.host.messageBox("Message2", "Title2", 3, 1);
}
Why is the dropdown value not changing? There are no other scripts associated with the dropdown list. I have also tested this.rawValue = 1; as the exit event and it works there. Puzzled.
Solved! Go to Solution.
Views
Replies
Total Likes
Views
Replies
Total Likes
Replace this.rawValue with xfa.event.change.
Kyle
Views
Replies
Total Likes
Thanks Kyle,
Your solution does work. Any idea why "this.rawValue" does not work?
Views
Replies
Total Likes
The value of most fields don't bind their values to the dataset model until you leave the field which is after the change event. I believe it's for performance purposes. Therefore, in the change event this.rawValue will only be the value that existed before the change.
Kyle
Views
Replies
Total Likes
I think I understand; if I am correct in my understanding then using this.rawValue to set the value of a field with a change event does not work because data binding occurs after the change event has expired--and to the field value last set (which would also explain the time lag and execution of other events before the caption change I requested gets executed) .
Thanks again.
Views
Replies
Total Likes
Views
Likes
Replies