Last active
August 29, 2015 14:14
-
-
Save Kudratullah/8ef7508b64ef2ef3c053 to your computer and use it in GitHub Desktop.
HTML5 Form With Validation
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>HTML5 Form Attribute</title> | |
</head> | |
<body> | |
<form name="contact-form" method="POST" action="sentmail.php"> | |
<p> | |
<label for="name">Name:</label> | |
<input type="text" id="name" name="name" | |
pattern=".{3,}" | |
title="Minimum 3 Characters Required" | |
required | |
> | |
<!-- Pattern set to allow not less then 3 Characters --> | |
</p> | |
<p> | |
<label for="email">Email:</label> | |
<input type="email" id="email" name="email" | |
autocorrect="off" | |
autocapitalize="off" | |
required | |
> | |
<!-- Turned off Auto Correction and Auto Capitalization in IOS/Mobile --> | |
</p> | |
<p> | |
<label for="sub">Subject:</label> | |
<input type="text" id="sub" name="subject" | |
pattern=".{5,}" | |
title="Minimum 5 Characters Required" | |
required | |
> | |
<!-- Pattern set to allow not less then 5 Characters --> | |
</p> | |
<p> | |
<label for="company">Company:</label> | |
<input type="text" id="company" name="company"> | |
</p> | |
<p> | |
<label for="web">Website:</label> | |
<input type="url" id="web" name="website"> | |
</p> | |
<p> | |
<label for="mgs">Message:</label> | |
<textarea id="mgs" name="message" | |
placeholder="Message" | |
pattern=".{20,}" | |
title="Minimum 20 Characters Required" | |
required | |
></textarea> | |
<!-- Pattern set to allow not less then 20 Characters --> | |
</p> | |
<p> | |
<label for="captcha">Captcha:</label> | |
<img src="captcha.php" alt="Security Image"> | |
<input type="text" id="captcha" name="captcha" | |
pattern=".{6,6}" | |
title="Captcha is not more than and less then 6 Characters" | |
required | |
autocomplete="off" | |
> | |
<!-- Pattern set to allow not less then or more then 6 Characters --> | |
<!-- Auto Complete Turned off for captcha field --> | |
</p> | |
<p> | |
<input type="submit" name="submit" value="Submit Message"> | |
</p> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment