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

validating problems

Elya42
Registered: Mar 3 2009
Posts: 59

I have attempted to write a validation script, it is as follows:

//allow user to enter only 4 or 0 and open app.alert for any other numbers entered.

if(this.field!=4);
{
else if(this.field!=0);
}
{
app.alert ("must score only 4 or 0");
}

I have tried several different ways and nothing is working. Where am I going wrong?

Elaine M

My Product Information:
Acrobat Pro 9.1, Macintosh
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
There is no "this.field" object. If you want to access the currently focused field, then you use the "event" object. To access the focused field's value, one uses the "value property of the the event object, "event.value".

// custom validation scirpt for validation tabif(event.value == 0 | event.value ==4){event.rc = true;} else {app.alert("Value must be 0 or 4");event.rc = false;}

You might want to review some of Thom Parker's tutorials and the eSeminars on demand on this site. And down load the Acrobat JavaScript documentation.

George Kaiser

Elya42
Registered: Mar 3 2009
Posts: 59
Asolutely wonderful. I was trying to complicate something that was so simple!!!!!!!!!!!!!!!!!!!!!!!
Thank you!!!!!!!!!!!!!!!!!!

Elaine M