Am using this code to require entry in a field if selection #30 is chosen from a drop-down. In testing it works but only after I select things twice, it seems to also need to refresh/clear out the values before it will make the field required. Example if I select any other choice the email goes ok, and the first time I select #30, it goes through, but if I select #30 a 2nd time, I get the pop-up message telling me at least one of the required fields has not been completed . . . . which is a 2nd part to this question. Is it possible to tell the person which field is missing data, or automatically place the cursor in the field? That is not as critical as the refreshing part. Thank you!
if(this.rawValue =='30')
{
Q11_Comments.mandatory
= "error";}
else
{
Q11_Comments.mandatory
= "disabled";}
Solved! Go to Solution.
Views
Replies
Total Likes
Dropdown selections don't register until you exit the field, so your code would probably work on the Exit event.
To get it to work when the selection is made you can use xfa.event.newText so try this as your if statement:
if (this.boundItem(xfa.event.newText) == '30')
Views
Replies
Total Likes
Dropdown selections don't register until you exit the field, so your code would probably work on the Exit event.
To get it to work when the selection is made you can use xfa.event.newText so try this as your if statement:
if (this.boundItem(xfa.event.newText) == '30')
Views
Replies
Total Likes
Thank you very much. Am not sure I understand what you mean about xfa.event.newText, but I moved the existing code to the exit event instead of change and its seems to work fine, thank you!
Views
Replies
Total Likes
If you use xfa.event.newText then dropdown list changes will work when the selection is made as opposed to waiting until the field is exited.
Ok, that is helpful, I'm with you now. Tested and changed back to the change event with below and it works like a charm, thank you for all your help.
if
(this.boundItem(xfa.event.newText) == '30'){
Q11_Comments.mandatory = "error";
}
else
{Q11_Comments.mandatory = "disabled";
}
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies