Functions with Regex for validation OR HTML5 Validator -


i've discovered html5 validator feature , feel easy use (and aesthetically pleasing, red warning borders , speech bubbles show required input format)!

however, don't know if better use functions regex manually check every user input, example:

    function check_title($title){     if(!preg_match("/^[0-9a-za-z]+$/", $title))         return false;     else         return true; } 

or use html5 validator, example:

<input type="text" name="username" placeholder="username" maxlength="16" pattern="[0-9a-za-z]{5,}" title="username must 5-16 length" required/> 

may know 1 more secure? because trying create secure website.

thank , have nice day!

html5 though latest rocking technology, yet still work in progress. older version of browser won't support it (you can find work around support it).

if support latest browser, html5 use. being client-side, can't find secure, think how you're presenting/supporting site.

else go regex, because still number of people using older version.

hope know this

html5shiv javascript workaround, discovered sjoerd visscher, enable styling of html5 elements in versions of internet explorer prior version 9, not allow unknown elements styled without javascript.

just found html5 validation

html5's constraint validation apis make adding client side validation forms quick while providing javascript api , css hooks customization.

while there still issues implementations , old browsers deal with, polyfill or server-side fallback can utilize these apis in forms today.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -