There are two main methods for validating forms: (usually done using Java Script).
Server-side validation is more secure but often more tricky to code, whereas client-side (Java Script) validation is easier to do and quicker too (the browser doesn't have to connect to the server to validate the form, so the user finds out instantly if they've missed out that required field! In this tutorial we'll build a simple form with client-side Java Script validation.
Although this seems like a trivial question, I am quite sure it is not :) I need to validate names and surnames of people from all over the world. If it were only English ones I think that this would cut it: I doubt that this is feasible - there are just to much Unicode symbols to exclude all unwanted symbols (and how will tell you what Chinese symbols to exclude?) and there are surly to many valid symbols to inlcude them all (and you will have Chinese symbols problem again).When the user does so, they may proceed and can supply value to the next available field.The later Java Script function created is called on onsubmit event of the form.I would not put any constraints on a user name - it may even contain numbers; think of aristocratic names. No matter what regex you come up with, I can find a name somewhere in the world that will break it.
That being said, you do need to sanitize input, to avoid the Little Bobby Tables problem.
Form validation is the process of checking that a form has been filled in correctly before it is processed.
For example, if your form has a box for the user to type their email address, you might want your form handler to check that they've filled in their address before you deal with the rest of the form.
They are shipped in English by default, but many other languages are available, thanks to the awesome international Parsley community. To load a different locale and its messages, include them after Parsley: The last loaded file will automatically set the messages locale for Parsley.
In the example above, we load both French and Italian translations, and use Italian.