required = attributes ที่ต้องใส่ลงไปใร tag input
pattern = รูปแบบตัวอักษรหรือตัวเลขหรืออักษรพิเศษ ที่เราต้องการจะกำหนด
title = เปรียบเสมือนข้อความที่แจ้งเตือนหลังจากที่ กรอกข้อมูลผิดรูปแบบที่กำหนด
โค้ด: เลือกทั้งหมด
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HTML5 Validation</title>
</head>
<body>
<form action="" method="post">
<table>
<tr>
<td>Name </td>
<td><input type="text" placeholder="Name" required pattern="[a-zA-Zก-ุฯ-๙\s]*" title="กรุณากรอกตัวอักษร"></td>
</tr>
<tr>
<td>LastName </td>
<td><input type="text" placeholder="lasrName" required pattern="[a-zA-Zก-ุฯ-๙\s]*" title="กรุณากรอกตัวอักษร"></td>
</tr>
<tr>
<td>Telephone</td>
<td><input type="text" placeholder="lasrName" required pattern="[0-9\s]*" title="กรุณากรอกตัวเลข"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="btnsave" value="Save"></td>
</tr>
</table>
</form>
</body>
</html>
http://www.w3schools.com/html/html_form_attributes.asp
ลิ้งที่เกี่ยวข้อง
https://www.mindphp.com/%E0%B8%9A%E0%B8% ... html5.html