Skip navigation
Currently Being Moderated

Script isn't working?

Jul 23, 2012 1:26 PM

Here's my script located on the click event of an invisible button:

 

//Create a variable to hold the document object

var v1 = form1.page1.selEquip.regEquip.rawValue


//REGULAR EQUIPMENT
if ((v1 == " ") || (v1 == null))

{
    xfa.host.messageBox( "Please select the type of equipment for this position" );
    xfa.host.setFocus("form1.page1.selEquip");   

}else {

{
Button4.execEvent("click");
}
}

 

When I test by clicking the initial button, nothing happens. Nothing shows in Ctrl + J nor does the script checker find anything wrong with the script.

 

Thanks,

MDawn

 
Replies
  • Currently Being Moderated
    Jul 23, 2012 10:49 PM   in reply to mdawn50

    Hi,

     

    there are two things to optimize in your code.

     

    1. You can use the isNull method to determine if a field has a value or not.

    2. The else expession is wrapped twice incurly brackets, which is not correct.

     

    if (form1.page1.selEquip.regEquip.isNull) {
        xfa.host.messageBox("Please select the type of equipment for this position");
        xfa.host.setFocus("form1.page1.selEquip");
    } else {
            Button4.execEvent("click");
    }
    
     
    |
    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