New to Acrobat JavaScript. Must be able to ensure a field has a value beginning with /s/ before allowing the form to be submitted. As simple as possible. I'm hoping to get a script that can be executed immediately before my form submission. If the field doesn't contain the value, then the form submission does not happen. Thank you.
var f = this.getField("Field1");
var f2 = f.value;
var v = f2.substring(0,3);
if (v !== '/s/')
{
app.alert({
cMsg: v,
cTitle: "Please re-enter the data.",
nIcon: 0,
nType: 1
});
}
This is JavaScript executing via a MouseUp Action of my submit button. Immediately following this script, I have a 'Submit a form' process that I DO NOT want to execute if the value in my field is not right. Can my JavaScript above do an immediate halt of all further processing? If so, how is that done?