2012-11-07 71 views
13

我正在使用文本区域和文本字段上的inputmode属性获取验证错误。验证程序告诉我属性inputmode不允许在此处输入元素但是the HTML5 spec indicates that it is allowedinputmode属性是否有效(以HTML5格式)还是不是?

是否有实际使用此代码做错了事,或者是有过错的验证?

这里是一个梗概情况下这将产生完全相同这种验证错误(两次)的,在一种情况下上的电子邮件输入,并且在另一上的文本区域。

<!DOCTYPE HTML> 
<html lang="en"> 
    <head> 
    <meta charset="utf-8"> 
    </head> 
    <body> 
    <form method="post" action="contactme.php">   
     <label class='pas block'> 
     Your E-Mail:<br/> 
     <input type='email' name='email' required inputmode='latin' placeholder='your e-mail here' /> 
     </label> 
     <label class='pas block'> 
       Your Message:<br/> 
       <textarea name='message' required inputmode='latin' placeholder='and your message here!'></textarea> 
     </label> 
    </form> 
    </body> 
</html> 
+0

也许验证程序不是HTML5验证程序或HTML5模式 –

+0

我尝试了w3c验证程序和whatwg验证程序。 两个验证器在HTML5模式,和(即,因为)本实施例中有一个DOCTYPE HTML5也许 – brennanyoung

+0

'inputmode'不能与(的某些值)联合'type'? –

回答

3

的HTML5规范说

下面的内容属性,不得指定,并不适用于元素:接受,ALT,检查,目录名,formaction,formenctype,formmethod,formnovalidate,formtarget ,高度,inputmode,max,min,src,step和width。

这下簿记细节在https://html.spec.whatwg.org/multipage/input.html#e-mail-state-(type=email)

+8

这个簿记细节专门用于'[type = email]'元素,以及文本和搜索状态([spec](http://www.whatwg.org/specs/web-apps/current-work/multipage/states -of-the-type-attribute.html#text-(type = text)-state-and-search-state-(type = search)))它表示*以下常用输入元素内容属性,IDL属性和方法适用于元素:..... * *** inputmode *** – rhgb

9

此外,请参阅有关哪些属性适用于这里的不同输入类型的图表: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#attr-input-type

的“INPUTMODE”属性仅适用于“文” “搜索”。

在另一个说明中,“inputmode”不是W3C HTML5属性,但它是W3C HTML 5.1属性(至少在我写这篇文章的时候)。

尝试http://www.OnlineWebCheck.com/更好的错误/警告消息。

+0

谢谢 - 该图表在清除(至少对我来说)非常方便,哪些选项/ attrs适用于哪些输入类型。 – dontGoPlastic

1

五年有人问后,有些人可能会问,为什么一些由@dsas列出的属性不会引发这样的错误,像enctype 答案很简单的支持,同时enctype例如获得了广泛的支持 inputmethod仅支持IE11和Edge 14,更多信息请点击here

相关问题