Validating form fields with javascript

by  |  05-Nov-2014 12:48

I've changed my form so that is has the id of contentform as well.However I do not think I have been interpreting your java change correctly.

However the function is only reporting issues with wrong email input, and its not validating the other fields in the form. Thanks HTML Edit: I just noticed you're using a class contentform and I thought it was an id.

I would also add an id to your form to be able to retrieve all form data with one DOM traversal instead of several.

To avoid this problem, you must validate form submissions using your server.

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.

Download Demo Source Our form contains two types of validation. Valid inputs will turn green while invalid inputs will turn red.

Community Discussion