Created
April 25, 2014 10:19
-
-
Save veryrobert/11284628 to your computer and use it in GitHub Desktop.
Form Validation for Errors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // <form id="myForm" name="myForm" action="demo_form.asp" onsubmit="return validateForm()" method="post" class="form" novalidate> | |
| function validateForm() | |
| { | |
| var x=document.forms["myForm"]["fname"].value; | |
| if (x==null || x=="") | |
| { | |
| $('input.required').addClass('warning'); | |
| $('input.required').after('<p class="warning four-eight">Form field entered incorrectly please try again</p>'); | |
| return false; | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment