Skip navigation
Currently Being Moderated

Conditional Required Field - Need help with refreshing

May 4, 2012 9:19 AM

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";
}
 
Replies
  • Currently Being Moderated
    May 4, 2012 10:10 AM   in reply to sparrowce

    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')

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2012 10:31 AM   in reply to sparrowce

    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.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points