html – Are you allowed to have an input without a value? – Education Career Blog

Is the following allowed?

<input type="hidden" name="field" />


It is fine in hidden fields. It is only required in checkbox and radio inputs. It can never be specified with a file input. See


XHTML 1.1 schema says that value is not mandatory:

 <xs:attributeGroup name="xhtml.input.attlist">
    <xs:attributeGroup ref="xhtml.Common.attrib"/>
    <xs:attribute name="type" type="xhtml.InputType.class" default="text"/>    
    <xs:attribute name="name" type="xh11d:CDATA"/>
    <xs:attribute name="value" type="xh11d:CDATA"/>
    <xs:attribute name="checked">
        <xs:restriction base="xs:NMTOKEN">
          <xs:enumeration value="checked"/>
    <xs:attribute name="size" type="xh11d:Number"/>
    <xs:attribute name="maxlength" type="xh11d:Number"/>
    <xs:attribute name="src" type="xh11d:URI"/>
    <xs:attribute name="tabindex" type="xh11d:Number"/>    
    <xs:attribute name="accesskey" type="xh11d:Character"/>


Yeah, form inputs are under your control to serve your requirements, so long as they’re well-formed and valid xhtml.

It does seem a touch pointless though.

Leave a Comment