When you play around with the function, you’ll notice that the validation function is only called when the focus leaves the field, so you have to click outside of the field to actually make that error message pop up.
In that case, the previous value of the field is restored, and the user has to enter the data again.
I have two example that prevent HTML tags are not allowed in textbox using focusout event of jquery. In the first example i use regular expression for prevent html tags in my textarea and in second example i user directly check with html tags.
One of the questions I get asked again and again is how to validate a field value in an Acro Form with a custom validation script.
Adobe provided a lot of infrastructure to do that with just a simple script.
Let’s take a look at how to do that with a text field that is only supposed to have a value of either ‘AAAA’ or ‘BBBB’ (yes, I know that this does not make much sense in a real PDF form).
You cannot rely on Java Script to avoid this security problem. You can also download this demo and check out the source as we go through this tutorial.
All credit cards are 16 digits and the 16th digit can be calculated based on the first 15 numbers.