The option of using pure HTML, sometimes with a touch of CSS, to complement Java Script form validation was until recently unthinkable.Sure there have been all kinds of whacky plug-ins over the years aimed at achieving this, but never a single standard that we could work towards.In other web browsers they can be used in combination with the .Obviously neither example is very limiting, but it will prevent people from entering completely wrong values, such as phone number, strings with multiple '@'s or spaces.As shown above, once you've added HTML5 attributes to your form elements, they can be easily styled using CSS so that each input field is clearly marked as valid or invalid. If you want something more restrictive you can add a 'pattern' attribute. thx Safari doesn't display any HTML5 validation messages, but it may prevent the form from submitting if any "required" fields are left blank. The red/green symbols are applied using CSS and do work in Safari, but are only an indication of whether the input for that field is valid.input field: This solution is still more complicated than it needs to be as it requires two extra images to be loaded. You forgot the most important part: by having these standard types to identify the fields, browsers can provide helpful autofill interfaces.The simplest change you can make to your forms is to mark a text input field as 'required': This informs the (HTML5-aware) web browser that the field is to be considered mandatory.
Other HTML5 input types include: -related options do have an effect at least in Opera, with pop-up calendars and other devices appearing to assist with input. But as you see, lots of strange looking URLs are actually valid.In addition to native Cold Fusion input validation using the VALIDATE attribute of the CFINPUT and CFTEXTINPUT tags, the following tags support the ONVALIDATE attribute , which allows you to specify a Java Script function to handle your CFFORM input validation: The ONERROR attribute allows you to specify a Java Script function you want to execute in the event of a failed validation.For example, if you specify a Java Script function to handle input validation in the ONVALIDATE attribute you can also specify a Java Script function in the ONERROR attribute to handle a failed validation, which returns a false value.Before you ask, and someone always does, these examples will currently work in the following browsers: Safari 5, Chrome 6, Opera 9, Firefox 4 Beta and the i Phone/i Pad.Also each browser has a slightly different default behaviour.