hey guys,
i just want know How to Create Text Field Which Accepts (Only Texts No Digits or Numbers)?
i want to insert validation that, field only accepts alphabates no number or digits are accepted!
thanks in advance!
In Designer, click on the field you need to validate and open the script window, set the Show drop-down list to validate in the drop-down list and place the code inside the script window. Make sure the Language is Javascript and Run At is set to Client. If you cant see the script window goto Window->Script Editor Menu item.
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
It is only a sample of matching text. You do need to update the regular expression to match your requirements. So if you wish to allow spaces in the input, you would add this to the regular expression as follows
var r = new RegExp("^[a-z' ']*$");
also wouldnt do uppercase for example, so you would *** A-Z to the regexp ( i.e. [a-zA-Z' ']) and so on
North America
Europe, Middle East and Africa
Asia Pacific