Form Standards - framework design
- Contact: Dave Taylor
- Return to main standards page
Here are some standards for form elements which I have put together which allow easy design customisation and take in to consideration common layouts.
Any more complex layouts within these form standards would be coded as individual components overriding the common form styles.
Revision History
This version was compiled on
- 22 July 2011
- Fixes to label for attributes and element ids/names
- 01 April 2011
- Added examples for `label-detail` alongside `label-error-msg`
- 25 March 2011
- Changed the error summary to use
<label>
tags instead of<a>
tags
Display options (required JavaScript)
Form type:
-
This displays the label to the left of the inputs
-
This displays the label above the inputs
Form elements
Grouped inputs
Validation Examples
Error Summary
<div class="form-errorSummary" style="display:none;">
<h4>error header</h4>
<ul>
<li><label for="error1">errordetails</label></li>
<li><label for="error2">errordetails</label></li>
<li><label for="error3">errordetails</label></li>
<li><label for="error4">errordetails</label></li>
<li><label for="error5">errordetails</label></li>
</ul>
</div>
error header
Errors on field-item
- Add
field-itemTerror
tofield-item
- Add
error-num
- Add
label-error-msg
- input id should correspond to label’s for attribute in error summary
<div class="field-item field-itemTerror">
<span class="error-num">
<span>Error: </span>1
</span>
<label class="label-text">Email</label>
<input id="fielditemerrorinput" type="text" />
<label for="fielditemerrorinput" class="label-error-msg">there is a validation error</label>
<div class="label-detail">field information</div>
</div>
Error: 1
field information
Errors on field-group
- You should hightlight the first input using a
label
<div class="field-group field-groupTerror cp-dateField">
<label for="fieldgrouperror-day" class="field-group-header">Date:</label>
<div class="field-item">
<label for="fieldgrouperror-day" class="label-text">Day</label>
<input id="fieldgrouperror-day" type="text" name="day" />
</div>
<div class="field-item field-itemTerror">
<label for="fieldgrouperror-month" class="label-text">Month</label>
<select id="fieldgrouperror-month" name="month">
<option>Jan</option>
</select>
</div>
<div class="field-item">
<label for="fieldgrouperror-year" class="label-text">Year</label>
<select id="fieldgrouperror-year" name="year">
<option>2010</option>
</select>
</div>
<label for="fieldgrouperror-day" class="label-error-msg">you have entered the wrong day</label>
<div class="label-error-msg">there is a validation error</div>
</div>
there is a validation error