Skip navigation
Currently Being Moderated

if/else with verify

Mar 30, 2012 11:22 AM

This is the script i have in the Change event of a checkbox:


if (xfa.resolveNode("this").rawValue == "1" && SSN.isNull)


     SSN.mandatory = "error";

     app.alert("Please fill in the Dependent SSN portion of this form.");    




     SSN.mandatory = "disabled";



I also need this to verify that the "age" field is >= 1, if not return a message.

  • Currently Being Moderated
    Mar 30, 2012 4:10 PM   in reply to tygerfarr



    If you are using the change event, you need to bear in mind that the event fires BEFORE the user's input has registered in the object's .rawValue.


    Either use xfa.event.newText instead of this.rawValue OR move the script to the clcik event (where this.rawValue is appropriate).


    I haven't checked the script - too late,



    Mark as:
  • Currently Being Moderated
    Apr 2, 2012 3:52 PM   in reply to tygerfarr



    I am surprised you are getting the script to work where you are using .rawValue in the change event.


    In any case, if you can to test the age field, then you have a couple of choices.

    1. You can incorporate it into the existing if/else statement, by using a && to create an "and" condition.
    2. You can extend the existing if/else statement with an else if(). For example, if()/else if()/else.
    3. Or you can create a completely separate if/else statement after the first one (eg in the same event).


    Hope that helps,



    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