These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Field Validation

Jeff P.
Registered: Dec 9 2009
Posts: 14

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.

My Product Information:
Acrobat Pro 9.2, Windows
Jeff P.
Registered: Dec 9 2009
Posts: 14
I have successfully checked the contents of the field and displayed an appropriate message using the following:

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?