I have got an error check that checks whether a user has entered any data into a field the code is as follows:
if ($FORM_DATA{firstname} eq "") {
print"Please enter your firstname<BR>";
}
The above code works fine. I am however wondering if anyone knows how to check if the user has entered digits or alphabetic characters.
I would like an Incorrect message to display as above if the user types digits into a field where alphabetical characters ahould be and vice versa does anyone have any ideas.
For example a credit card number field should only contain digits and no alphabetical characters, if the user does enter any alphabetical characters then an Incorrect message is displayed.
I have looked in books but can only find error checking for a blank field.
An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.
One of a set of tools we're offering as a way of saying thank you for being a part of the community.
print"firstname must contain ONLY digits<BR>";
}
if ($FORM_DATA{firstname} =~ /[^a-zA-Z]/) {
print"firstname must contain ONLY alphabets<BR>";
}