no.
no.

Reputation: 2376

HTML5 Valid Form Input/Fields

I'm a little confused as to what is considered valid markup for HTML5 input fields.

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Site Name</title>
</head>

<body>

    <form name="contact" method="post" action="/">
       <p><input type="input" name="first_name" maxlength="255" /></p>
    </form>

</body>

</html>

When I run this through the validator at w3.org I get the error Bad value input for attribute type on element input. with the /> highlighted in red. I look at the HTML-Tidy version it creates and it tells me to write it like this instead:

<p><input type="input" name="first_name" maxlength="255"></p>

But then when I validate that I then get the same error but with just the > highlighted in red. Then looking at the HTML-Tidy to see what it has corrected it to and it leaves is the same as if it's okay, but the error is still there. Is this considered valid HTML5 markup? Or is there a specific way of doing this?

Upvotes: 2

Views: 11470

Answers (2)

Veger
Veger

Reputation: 37906

type="input" is an invalid value of the attribute type of the input element.

This guide on the input element shows the allowed type attributes. Or check the HTML5 additional input types if you require one of those.

For a regular textfield you need to set the type attribute to type="text".

Upvotes: 5

Lyth
Lyth

Reputation: 2201

Input type "input" is not correct, you probably intented to use type="text".

Upvotes: 2

Related Questions