禁用 HTML5 輸入表單字段驗證。
HTML5 提供一項新功能,可輕松實現輸入表單字段驗證。通過 required 屬性,可指定是否必須填寫某一輸入表單字段。指定字段類型可確保根據輸入類型對輸入進行檢查。甚至還可以使用自定義 pattern 屬性根據正則表達式來對輸入進行檢查。然而,在表單標簽上添加 novalidate 屬性以及在提交輸入標簽上添加 formnovalidate 屬性時,將禁用這一驗證功能。
例 1:以下示例通過 novalidate 屬性禁用表單驗證。
<form action="demo_form.asp" novalidate="novalidate">
E-mail:<input type="email" name="user_email" />
<input type="submit" />
</form>
formnovalidate 屬性禁用表單驗證。
<form action="demo_form.asp" >
E-mail:<input type="email" name="user_email" />
<input type="submit" formnovalidate="formnovalidate"/>
</form>
[1] Standards Mapping - OWASP Top 10 2004 - (OWASP 2004) A1 Unvalidated Input
[2] Standards Mapping - OWASP Top 10 2010 - (OWASP 2010) A6 Security Misconfiguration
[3] Standards Mapping - Security Technical Implementation Guide Version 3 - (STIG 3) APP3510 CAT I
[4] Standards Mapping - Security Technical Implementation Guide Version 3.4 - (STIG 3.4) APP3510 CAT I
[5] Standards Mapping - Common Weakness Enumeration - (CWE) CWE ID 20
[6] HTML5 form novalidate Attribute W3Schools
[7] HTML5 input formnovalidate Attribute W3Schools
[8] Standards Mapping - Payment Card Industry Data Security Standard Version 1.2 - (PCI 1.2) Requirement 6.3.1.1
[9] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 - (PCI 1.1) Requirement 6.5.1
[10] Standards Mapping - FIPS200 - (FISMA) SI