Posts

Showing posts with the label validation

JQuery : Simple Regular expression for Email validation

Email validation is always required when we have a form or login / sign up pages. If we are using JQuery, the below regular expression will be simple and easy to use for validating an email address. Testemail = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/i; So we can write this in a function : function TestValidEmail(sEmail) { var Testemail  = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/i ; if ( Testemail   .test(sEmail)) { return true; } else { return false; } }

Blank space validation in ColdFusion cfinput

For validating a required input field for blank space, we can use the attribute 'Validate="noblanks"  in the cfinput tag. For example, <cfform name="test" method="post" action="" > Name:<cfinput type="text" name="firstname"  required="yes" validate="noblanks"  message="Please Enter Your firstname"> <cfinput type=" submit" name="submit" value="Submit"> </cfform>