Skip to content

Instantly share code, notes, and snippets.

@jenstrickland
Last active August 29, 2015 14:16
Show Gist options
  • Save jenstrickland/0ba6c58703fc248cce6c to your computer and use it in GitHub Desktop.
Save jenstrickland/0ba6c58703fc248cce6c to your computer and use it in GitHub Desktop.
HTML Base for a Best-Practices, Accessible Form
<form role="form"> <!-- if a search form make the role="search" -->
<label for="name">Name
<input type="text" id="name" name="name" size="27" class="required"/>
</label>
<label for="comments">Comments
<textarea name="comments" id="comments"></textarea>
</label>
<label for="robot_val">I am a *</label>
robot: <input type="radio" name="robot_val" value="robot" role="menuitemradio" checked="checked" />
human: <input type="radio" name="robot_val" value="human" role="menuitemradio" />
<input type="hidden" name="stage" value="process"/>
<input type="submit" name="rick" value="Submit" class="submit" role="button"/>
<!-- i make the name="rick" because the NAME SHOULD NEVER BE SUBMIT and @rwaldron taught me this -->
</form>
<!-- started in haml -->
<!-- %form{:for => "form"} -->
<!-- %label{:for => "name"}name -->
<!-- = text_field_tag :name -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment