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
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");
}
North America
Europe, Middle East and Africa
Asia Pacific