Help with validating a numerical (text) field.

Dec 07, 2017

Copy link to clipboard

Copied

On my form I have several numerical fields that must be completed.  I checked the "Required" property box, but I don't see any benefit.  So I used a "On Blur" script type with the javascript below.  This works but the function fires 3 times before the cursor is back in the field for correction.  Below is my script.

var oal = this.getField("OAL");

if (oal.value == 0)

{

app.alert('Must complete Over-All-Length field!');

oal.setFocus();

}

TOPICS
Acrobat SDK and JavaScript, Windows

Views

64

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Help with validating a numerical (text) field.

Dec 07, 2017

Copy link to clipboard

Copied

On my form I have several numerical fields that must be completed.  I checked the "Required" property box, but I don't see any benefit.  So I used a "On Blur" script type with the javascript below.  This works but the function fires 3 times before the cursor is back in the field for correction.  Below is my script.

var oal = this.getField("OAL");

if (oal.value == 0)

{

app.alert('Must complete Over-All-Length field!');

oal.setFocus();

}

TOPICS
Acrobat SDK and JavaScript, Windows

Views

65

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Dec 07, 2017 0

Have something to add?

Join the conversation