Avatar

Level 5

Not sure if you are looking for an actual validation for the field (i.e. show an error and stop the user from moving to the next field) or just a filter in the field (i.e. no message and just stop characters being entered). From the original message i was assuming you were looking for a validation.

If you want to use a message box validation and return to the field containing the error, use the following -

On the exit event

var r = new RegExp("^[a-z]*$");

var result = r.test(this.rawValue);

if ( result != true )

{

    xfa.host.messageBox( "Enter alpha characters only" );

    xfa.host.setFocus( this );

}

If you are looking for a filter then, use the following on a change event of the field

var r = new RegExp("^[a-z]*$");

var result = r.test(xfa.event.change);

if ( result != true )

{

    xfa.event.change = "";

}

this will probably only work in pdf and some versions of reader had a bug with this so make sure you are on 10.1.2 to test this. see http://forums.adobe.com/thread/910259