Code for validating forms in javascript ikhar dating

You can then adapt this form to your own requirements.

We'll also look at how to check other types of fields, such as checkboxes, radio buttons and drop-down lists.

Let's look at a more complex validated form with some different types of form fields. Try pressing the Send Details button without filling in the form and see what happens.

So if you select the second item in the drop down, a text field associated with that selection appears.

My issue is how to make that text field required, but only required based on drop down selection. I am writing a script that validates two select menus. I need to check that it is not "empty" and if not they are alpha characters with -, space and ' special characters and with a limit of 30 chars. @eyefly: I'm guessing you're using cgiemail to process your form on the server?

One point to note about Java Script validation is that it can always be circumvented by the user disabling Java Script in their browser, so for secure validation you'll need to write your validating code in your server-side scripts.

Last modified 30-May-2018 20:38