Answered
I have a JavaScript code that combines specific versions of forms based upon a set of user-specified state abbreviations. The validation function runs just fine, returning "false" if the type of compilation is not appropriate for one or more states. I want to alert the user that state(s) in the list is not appropriate, and stop the entire script following the user-clicked "OK". When I run the script from the console, it throws an "invalid break" error. Here is the offending set of code:
var aListOfStates = new Array(); if (targetStates == "ALL") { aListOfStates = aAllStates; targetStates = aAllStates.join(","); } else { var noMatch = ""; aListOfStates = targetStates.split(","); for (i = 0; i<aListOfStates.length; i++) { if (aAllStates.exists(aListOfStates[i]) == false) { noMatch += aListOfStates[i] + ","; } } if (noMatch != "") { app.alert("These states are not eligible for creating life application packets: " + noMatch); break; } }
All variables listed without the "var" are initialized earlier in the code.
(I apologize in advance if the formatting is poor: this is the first time I've added code to a message in this forum.)
In lieu of rewriting this, is there something I'm totally missing about using a break here?
Thanks for any suggestions and comments!
George