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!
Solved! Go to Solution.
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.
Views
Replies
Total Likes
For alphabetical characters only, use the following javascript on the validate event of the text field
var r = new RegExp("^[a-z]*$");
var result = r.test(this.rawValue);
if (result == true)
true;
else
false;
Also, set the Validation Script Message properties in the Object->Value Tab
Views
Replies
Total Likes
Im not getting you.
where to put this script that you have coded?
Views
Replies
Total Likes
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.
Views
Replies
Total Likes
Yes, you have answered my question 90%,
but im still able to insert digits (or integer or number values) into that field, it shows me error message when i move over to another field.
Views
Replies
Total Likes
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
i want a script that dont allow even to let user type numeric values.
ie. if i take numeric field it wont allow me even to enter alphabates. i want reverse thing, i dont want to allow user to type or insert numeric values to text field
Views
Replies
Total Likes
Try the second example in the previous message. That will disable any non-alpha input. Put it on the change event and remove any other event code.
thanks mate,
i was putting the code in validate event!
what is the difference between change and validate events?
sorry if its off topic.
thanks again
Views
Replies
Total Likes
The change event is fired each time a user interacts with an object using keystroke, paste, list selection, select/deselect check bos, or change radio button. The validate on the other hand only fires when the field losses when you tab to the next field for example
got all answers!
thanks a ton
Views
Replies
Total Likes
your script is not allowing me to enter a "Blank Space".
Views
Replies
Total Likes
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 ass A-Z to the regexp ( i.e. [a-zA-Z' ']) and so on
Views
Likes
Replies
Views
Likes
Replies