Definition
This component is used for building simple forms.
Usage
A simple form with a basic stack layout, where labels are spaced to the left of fields.
There are five basic field types:
Labeled input, which contain a label followed by a text input, password input, select menu or textarea.
<div class="labeled-input">
Checkboxes, which contain one or more labeled check boxes.
<div class="checkboxes">
Radio buttons, which contain a pseudo-label followed by two or more labeled radio buttons.
<div class="radiobuttons">
Vertically-stacked radio buttons, which contain a pseudo-label followed by two or more labeled radio buttons.
<div class="stacked-radiobuttons">
Submit buttons, which contain one or more submit buttons.
<div class="submit">
There's also an additional type of section that can contain just information and no inputs.
<div class="info">
Horizontal rules can be used, if needed, to make the form's structure clearer.
<div class="hr"><hr></div>
Required fields should be indicated by using an asterisk icon, with the alt text of "(required)" so that screen readers can understand it, and the corresponding input should have class="required".
<img src="http://www-cdn.sun.com/im/ic_asteric.gif" alt="(required)" class="required-icon">
Error messaging is shown in variation 0, example 1 , and can be used to redisplay the form and indicate an invalid submission.
Optionally, these classes may be used on text inputs to give consistency to the form: "short," "medium" and "long."
These allow CSS to size the inputs appropriately.
If all inputs use these, then the form fields will have a neater, lined up appearance, instead of a "ragged" edge.
<input type="text" name="middle_initial" class="short">
<input type="text" name="first_name" class="medium">
<input type="text" name="url" class="long">
Always make sure that labels are associated with their inputs.
This is perhaps the most important accessibility feature for forms.
Within the label element, make sure that the for attribute references the id attribute of the appropriate input element.
Also remember that id attributes must be unique across the entire document.
Alternatively, nest the field within the label.
Here are examples:
<label for="firstname">First Name</label>
<input type="text" id="firstname">
<!-- or -->
<label><input type="radio"> Yes</label>
<label><input type="radio"> No</label>
For more complex forms, <fieldset> and <legend> should be used to separate form inputs into logical groups.
This improves accessibility and usability for the form.
The grey container and this red paragraph is only here to illustrate this component used in the D7 or PC1 components to give it a grey background color.
No Templates Reference this
v0
x1
Basic Form, showing error message
There was a problem with your submission. Not all required fields were filled in.
The grey container and this red paragraph is only here to illustrate this component used in the D7 or PC1 components to give it a grey background color.
Copy the code below and paste into your text editor.
<!-- BEGIN G25 COMPONENT V.0 -->
<div class="g25">
<form action="" method="post">
<!-- BEGIN G29 COMPONENT V.0 -->
<div class="g29 g29v0"><div class="g29w1"><div class="g29w2">
<p>There was a problem with your submission. Not all required fields were filled in.</p>
</div></div></div>
<!-- END G29 COMPONENT V.0 -->
<div class="labeled-input">
<p class="label"><label for="fruits2">Fruits</label></p>
<p class="input">
<select id="fruits2" name="fruits">
<option value="apples">Apples</option>
<option value="oranges">Oranges</option>
<option value="bananas">Bananas</option>
<option value="peaches">Peaches</option>
</select>
</p>
</div>
<div class="labeled-input">
<p class="label"><label for="vegetables2">Vegetables</label></p>
<p class="input">
<select id="vegetables2" name="vegetables">
<option value="greenbeans">Green Beans</option>
<option value="celery">Celery</option>
<option value="spinach">Spinach</option>
<option value="squash">Squash</option>
<option value="cucumbers">Cucumbers</option>
</select>
</p>
</div>
<div class="labeled-input">
<p class="label"><label for="name2" class="error"><img src="/im/ic_asteric.gif" alt="(required) " class="required-icon" /> Your Name</label></p>
<p class="input"><input class="error medium required" type="text" size="25" id="name2" name="name" /></p>
</div>
<div class="radiobuttons">
<p class="label"><label for="contact-email2">Contact me via</label></p>
<p class="radiobuttons">
<label><input type="radio" name="contact" value="email" id="contact-email2" checked="checked" /> Email</label>
<label><input type="radio" name="contact" value="phone" id="contact-phone2" /> Phone</label>
</p>
</div>
<div class="checkboxes">
<p><label><input type="checkbox" /> I agree to the <a href="{linkplaceholder}">license agreement</a></label></p>
<p><label><input type="checkbox" /> Please contact me</label></p>
<p><label><input type="checkbox" /> I am over the age of thirty seven</label></p>
</div>
<div class="hr"><hr /></div>
<div class="submit">
<p>
<input type="submit" class="hotbutton" value="Submit »" />
</p>
</div>
</form>
</div>
<!-- END G25 COMPONENT V.0 -->
No Templates Reference this
v1
Basic Form With Options for Label Column Size
Identical to variation 0, but allows more room for long text labels.
The grey container and this red paragraph is only here to illustrate this component used in the D7 or PC1 components to give it a grey background color.
Copy the code below and paste into your text editor.
<!-- BEGIN G25 COMPONENT V.1 -->
<div class="g25 g25biglabels">
<form action="" method="post">
<div class="labeled-input">
<p class="label"><label for="fruits3">Your Favorite Kinds of Fruits</label></p>
<p class="input">
<select id="fruits3" name="fruits">
<option value="apples">Apples</option>
<option value="oranges">Oranges</option>
<option value="bananas">Bananas</option>
<option value="peaches">Peaches</option>
</select>
</p>
</div>
<div class="labeled-input">
<p class="label"><label for="vegetables3">Favorite Kinds of Vegetables</label></p>
<p class="input">
<select id="vegetables3" name="vegetables">
<option value="greenbeans">Green Beans</option>
<option value="celery">Celery</option>
<option value="spinach">Spinach</option>
<option value="squash">Squash</option>
<option value="cucumbers">Cucumbers</option>
</select>
</p>
</div>
<div class="labeled-input">
<p class="label"><label for="name3"><img src="/im/ic_asteric.gif" alt="(required) " class="required-icon" /> Your First Name</label></p>
<p class="input"><input type="text" size="25" id="name3" name="name" class="medium required" /></p>
</div>
<div class="radiobuttons">
<p class="label"><label for="contact-email3">Contact me via</label></p>
<p class="radiobuttons">
<label><input type="radio" name="contact" value="email" id="contact-email3" checked="checked" /> Email</label>
<label><input type="radio" name="contact" value="phone" id="contact-phone3" /> Phone</label>
</p>
</div>
<div class="checkboxes">
<p><label><input type="checkbox" /> I agree to the <a href="{linkplaceholder}">license agreement</a></label></p>
<p><label><input type="checkbox" /> Please contact me</label></p>
<p><label><input type="checkbox" /> I am over the age of thirty seven</label></p>
</div>
<div class="hr"><hr /></div>
<div class="submit">
<p>
<input type="submit" class="hotbutton" value="Submit »" />
</p>
</div>
</form>
</div>
<!-- END G25 COMPONENT V.1 -->
No Templates Reference this
v1
x1
Basic Form With Less Label Room
Identical to variation 0, but with narrower column for text labels.
The grey container and this red paragraph is only here to illustrate this component used in the D7 or PC1 components to give it a grey background color.
Copy the code below and paste into your text editor.
<!-- BEGIN G25 COMPONENT V.1 -->
<div class="g25 g25smlabels">
<form action="" method="post">
<div class="labeled-input">
<p class="label"><label for="fruits3">Favorite Fruits</label></p>
<p class="input">
<select id="fruits3" name="fruits">
<option value="apples">Apples</option>
<option value="oranges">Oranges</option>
<option value="bananas">Bananas</option>
<option value="peaches">Peaches</option>
</select>
</p>
</div>
<div class="labeled-input">
<p class="label"><label for="vegetables3">Favorite Veggies</label></p>
<p class="input">
<select id="vegetables3" name="vegetables">
<option value="greenbeans">Green Beans</option>
<option value="celery">Celery</option>
<option value="spinach">Spinach</option>
<option value="squash">Squash</option>
<option value="cucumbers">Cucumbers</option>
</select>
</p>
</div>
<div class="labeled-input">
<p class="label"><label for="name3"><img src="/im/ic_asteric.gif" alt="(required) " class="required-icon" /> Your First Name</label></p>
<p class="input"><input type="text" size="25" id="name3" name="name" class="medium" /></p>
</div>
<div class="radiobuttons">
<p class="label"><label for="contact-email3">Contact me via</label></p>
<p class="radiobuttons">
<label><input type="radio" name="contact" value="email" id="contact-email3" checked="checked" /> Email</label>
<label><input type="radio" name="contact" value="phone" id="contact-phone3" /> Phone</label>
</p>
</div>
<div class="checkboxes">
<p><label><input type="checkbox" /> I agree to the <a href="{linkplaceholder}">license agreement</a></label></p>
<p><label><input type="checkbox" /> Please contact me</label></p>
<p><label><input type="checkbox" /> I am over the age of thirty seven</label></p>
</div>
<div class="hr"><hr /></div>
<div class="submit">
<p>
<input type="submit" class="hotbutton" value="Submit »" />
</p>
</div>
</form>
</div>
<!-- END G25 COMPONENT V.1 -->
No Templates Reference this
v2
Basic Form Using Fieldset and Legend
Groups forms into logical subsections for accessibility and usability purposes.
Enter the following information to register for a Sun Online Account. » Why Register?
Indicates a required field
Personal Information
You will need a valid Sun Partner agreement and will be asked additional questions.
Yes, I'd like to receive general communications from Sun on products, promotions, news, and events.
Note: Your choice here will apply to all Sun Online Accounts with this email address.
The grey container and this red paragraph is only here to illustrate this component used in the D7 or PC1 components to give it a grey background color.
Copy the code below and paste into your text editor.
<!-- BEGIN G25 COMPONENT V.2 -->
<div class="g25">
<form method="post" action="some.cgi">
<p class="intro">Enter the following information to register for a Sun Online Account. <a href="{linkplaceholder}"><b>» Why Register?</b></a></p>
<p class="indicates-required"><img src="/im/ic_asteric.gif" alt="(required)" class="required-icon" /> Indicates a required field</p>
<div class="fieldset">
<fieldset>
<legend>Login Information</legend>
<div class="labeled-input">
<p class="label"><label for="f1text1"><img src="/im/ic_asteric.gif" alt="(required)" class="required-icon" /> Email Address</label></p>
<p class="input"><input type="text" id="f1text1" size="30" value="" class="medium required" />
<span class="help">Will be your username</span>
</p>
</div>
<div class="labeled-input">
<p class="label"><label for="f1text2"><img src="/im/ic_asteric.gif" alt="(required)" class="required-icon" /> Password</label></p>
<p class="input"><input type="password" id="f1text2" size="30" class="medium required" />
<span class="help">6-36 Characters</span>
</p>
</div>
<div class="labeled-input">
<p class="label"><label for="f1text3"><img src="/im/ic_asteric.gif" alt="(required)" class="required-icon" /> Retype Password</label></p>
<p class="input"><input type="password" id="f1text3" size="30" class="medium required" /></p>
</div>
</fieldset>
</div>
<div class="fieldset">
<fieldset>
<legend>Personal Information</legend>
<div class="labeled-input">
<p class="label"><label for="f1text4"><img src="/im/ic_asteric.gif" alt="(required)" class="required-icon" /> First Name</label></p>
<p class="input"><input type="text" id="f1text4" size="30" value="" class="medium required" /></p>
</div>
<div class="labeled-input">
<p class="label"><label for="f1text5">Middle Initial</label></p>
<p class="input"><input type="text" id="f1text5" size="2" value="" class="short" /></p>
</div>
<div class="labeled-input">
<p class="label"><label for="f1text6"><img src="/im/ic_asteric.gif" alt="(required)" class="required-icon" /> Last Name</label></p>
<p class="input"><input type="text" id="f1text6" size="30" value="" class="medium required" /></p>
</div>
<div class="labeled-input">
<p class="label"><label for="f1pulldownCountry"><img src="/im/ic_asteric.gif" alt="(required)" class="required-icon" /> Country / Territory</label></p>
<p class="input">
<select id="f1pulldownCountry" name="country" class="required">
<option value="">-- Select Country/Territory --</option>
<option value="Zimbabwe" >Zimbabwe</option>
</select>
</p>
</div>
<div class="hr"><hr /></div>
<div class="radiobuttons">
<p class="label"><label for="sun-partner-yes">Are you a Sun Partner?</label></p>
<p class="radiobuttons">
<label><input type="radio" name="partner" value="yes" id="sun-partner-yes" /> Yes</label>
<label><input type="radio" name="partner" value="no" id="sun-partner-no" checked="checked" /> No</label>
</p>
</div>
<div class="info">
<p class="help">You will need a valid Sun Partner agreement and will be asked additional questions.</p>
</div>
<div class="hr"><hr /></div>
<div class="radiobuttons">
<p class="label"><label for="sdn-yes">Join Sun Developer Network?</label></p>
<p class="radiobuttons">
<label><input type="radio" name="developer" value="yes" id="sdn-yes" /> Join</label>
<label><input type="radio" name="developer" value="no" id="sdn-no" checked="checked" /> Decline</label>
</p>
</div>
<div class="info">
<p class="help">Membership is free. <a href="{linkplaceholder}">Learn More »</a></p>
</div>
<div class="hr"><hr /></div>
<div class="radiobuttons">
<p class="label"><label for="comm-yes">Receive Sun Communications?</label></p>
<p class="radiobuttons">
<label><input type="radio" name="communications" value="yes" id="comm-yes" /> Yes</label>
<label><input type="radio" name="communications" value="no" id="comm-no" checked="checked" /> No</label>
</p>
</div>
<div class="info">
<p class="help">
Yes, I'd like to receive general communications from Sun on products, promotions, news, and events.
<em>Note:</em> Your choice here will apply to all Sun Online Accounts with this email address.
</p>
</div>
</fieldset>
</div>
<div class="fieldset">
<fieldset>
<legend>General Terms of Use</legend>
<p>
If you agree with the <a target="_new" href="{linkplaceholder}">Sun Online Account terms of use</a>, please complete and submit this form.
</p>
<div class="hr"><hr /></div>
<div class="submit">
<input type="submit" class="hotbutton" value="Register »" />
<input type="reset" class="defbutton" value="Reset" />
</div>
</fieldset>
</div>
</form>
</div>
<!-- END G25 COMPONENT V.2 -->
No Templates Reference this
v2
x1
Basic Form Using Fieldset and Legend, Exhaustive Example
This example shows variations in the ways that fields can be labeled and arranged.
Enter the following information to register for a Sun Online Account. » Why Register?
Indicates a required field
Login Information (Alternate Presentation)
If inline help/tip text is so long that it wraps, then it must be presented in this alternate fashion.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam id orci. Curabitur ultricies gravida est. Praesent lacinia egestas diam.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Personal Information
You will need a valid Sun Partner agreement and will be asked additional questions.
Yes, I'd like to receive general communications from Sun on products, promotions, news, and events.
Note: Your choice here will apply to all Sun Online Accounts with this email address.
The grey container and this red paragraph is only here to illustrate this component used in the D7 or PC1 components to give it a grey background color.
Copy the code below and paste into your text editor.
<!-- BEGIN G25 COMPONENT V.2 -->
<div class="g25">
<form method="post" action="some.cgi">
<p class="intro">Enter the following information to register for a Sun Online Account. <a href="{linkplaceholder}"><b>» Why Register?</b></a></p>
<p class="indicates-required"><img src="/im/ic_asteric.gif" alt="(required)" class="required-icon" /> Indicates a required field</p>
<div class="fieldset">
<fieldset>
<legend>Login Information</legend>
<div class="labeled-input">
<p class="label"><label for="f2text1"><img src="/im/ic_asteric.gif" alt="(required)" class="required-icon" /> Email Address</label></p>
<p class="input"><input type="text" id="f2text1" size="30" value="" class="medium required" />
<span class="help">This will be your username</span>
</p>
</div>
<div class="labeled-input">
<p class="label"><label for="f2text2"><img src="/im/ic_asteric.gif" alt="(required)" class="required-icon" /> Password</label></p>
<p class="input"><input type="password" id="f2text2" size="30" class="medium required" />
<span class="help">6-36 Characters, case-sensitive</span>
</p>
</div>
<div class="labeled-input">
<p class="label"><label for="f2text3"><img src="/im/ic_asteric.gif" alt="(required)" class="required-icon" /> Retype Password</label></p>
<p class="input"><input type="password" id="f2text3" size="30" class="medium required" /></p>
</div>
</fieldset>
</div>
<div class="fieldset">
<fieldset>
<legend>Login Information (Alternate Presentation)</legend>
<div class="labeled-input">
<p class="label"><label for="f2text4"><img src="/im/ic_asteric.gif" alt="(required)" class="required-icon" /> Email Address</label></p>
<p class="input"><input type="text" id="f2text4" size="30" value="" class="medium required" /></p>
</div>
<div class="info">
<p class="help">If inline help/tip text is so long that it wraps, then it must be presented in this alternate fashion.</p>
</div>
<div class="labeled-input">
<p class="label"><label for="f2text5"><img src="/im/ic_asteric.gif" alt="(required)" class="required-icon" /> Password</label></p>
<p class="input"><input type="password" id="f2text5" size="30" class="medium required" />
</p>
</div>
<div class="info">
<p class="help">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam id orci. Curabitur ultricies gravida est. Praesent lacinia egestas diam.</p>
</div>
<div class="labeled-input">
<p class="label"><label for="f2text6"><img src="/im/ic_asteric.gif" alt="(required)" class="required-icon" /> Retype Password</label></p>
<p class="input"><input type="password" id="f2text6" size="30" class="medium required" /></p>
</div>
<div class="info">
<p class="help">Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p>
</div>
</fieldset>
</div>
<div class="fieldset">
<fieldset>
<legend>Personal Information</legend>
<div class="labeled-input">
<p class="label"><label for="f2text7"><img src="/im/ic_asteric.gif" alt="(required)" class="required-icon" /> First Name</label></p>
<p class="input"><input type="text" id="f2text7" size="30" value="" class="medium required" /></p>
</div>
<div class="labeled-input">
<p class="label"><label for="f2text8">Middle Initial</label></p>
<p class="input"><input type="text" id="f2text8" size="2" value="" class="short" /></p>
</div>
<div class="labeled-input">
<p class="label"><label for="f2text9"><img src="/im/ic_asteric.gif" alt="(required)" class="required-icon" /> Last Name</label></p>
<p class="input"><input type="text" id="f2text9" size="30" value="" class="medium required" /></p>
</div>
<div class="labeled-input">
<p class="label"><label for="f2pulldownCountry"><img src="/im/ic_asteric.gif" alt="(required)" class="required-icon" /> Country / Territory</label></p>
<p class="input">
<select id="f2pulldownCountry" name="country" class="required">
<option value="">-- Select Country/Territory --</option>
<option value="Zimbabwe" >Zimbabwe</option>
</select>
</p>
</div>
<div class="hr"><hr /></div>
<div class="radiobuttons">
<p class="label"><label for="sun-partner-yes2">Are you a Sun Partner?</label></p>
<p class="radiobuttons">
<label><input type="radio" name="partner" value="yes" id="sun-partner-yes2" /> Yes</label>
<label><input type="radio" name="partner" value="no" id="sun-partner-no2" checked="checked" /> No</label>
</p>
</div>
<div class="info">
<p class="help">You will need a valid Sun Partner agreement and will be asked additional questions.</p>
</div>
<div class="hr"><hr /></div>
<div class="radiobuttons">
<p class="label"><label for="sdn-yes2">Join Sun Developer Network?</label></p>
<p class="radiobuttons">
<label><input type="radio" name="developer" value="yes" id="sdn-yes2" /> Join</label>
<label><input type="radio" name="developer" value="no" id="sdn-no2" checked="checked" /> Decline</label>
</p>
</div>
<div class="info">
<p class="help">Membership is free. <a href="{linkplaceholder}">Learn More »</a></p>
</div>
<div class="hr"><hr /></div>
<div class="stacked-radiobuttons">
<p class="label"><label for="coolest1">Which one is the coolest?</label></p>
<p><label><input type="radio" name="coolest" value="coolest1" id="coolest1" checked="checked" /> This thing</label></p>
<p><label><input type="radio" name="coolest" value="coolest2" id="coolest2" /> That other thing</label></p>
<p><label><input type="radio" name="coolest" value="coolest3" id="coolest3" /> The one with the mojo</label></p>
<p><label><input type="radio" name="coolest" value="coolest4" id="coolest4" /> Some sort of machine</label></p>
<p><label><input type="radio" name="coolest" value="coolest5" id="coolest5" /> Hulk Hogan</label></p>
</div>
<div class="hr"><hr /></div>
<div class="checkboxes">
<p class="label">Check all that apply</p>
<p><label><input type="checkbox" name="pester1" value="yes" /> Send me emails</label></p>
<p><label><input type="checkbox" name="pester2" value="yes" /> Call me on the phone</label></p>
<p><label><input type="checkbox" name="pester3" value="yes" /> Come to my house</label></p>
<p><label><input type="checkbox" name="pester4" value="yes" /> Write me letters</label></p>
</div>
<div class="hr"><hr /></div>
<div class="checkboxes">
<p>
<label><input type="checkbox" name="comm" value="yes" /> Receive Sun Communications</label>
</p>
</div>
<div class="info">
<p class="help">
Yes, I'd like to receive general communications from Sun on products, promotions, news, and events.
<em>Note:</em> Your choice here will apply to all Sun Online Accounts with this email address.
</p>
</div>
</fieldset>
</div>
<div class="fieldset">
<fieldset>
<legend>Big Text Area</legend>
<div class="labeled-input">
<p class="label"><label for="textarea1">Words of wisdom</label></p>
<p class="input"><textarea id="textarea1" rows="7">All we are is dust in the wind, dude</textarea></p>
</div>
</fieldset>
</div>
<div class="fieldset">
<fieldset>
<legend>General Terms of Use</legend>
<p>
If you agree with the <a target="_new" href="{linkplaceholder}">Sun Online Account terms of use</a>, please complete and submit this form.
</p>
<div class="hr"><hr /></div>
<div class="submit">
<input type="submit" class="hotbutton" value="Register »" />
<input type="reset" class="defbutton" value="Reset" />
</div>
</fieldset>
</div>
</form>
</div>
<!-- END G25 COMPONENT V.2 -->
No Templates Reference this
v3
JS Calendar Picker Field
If you add class="jscal" to a text input field, it triggers calendar picker behavior onfocus of the text field.
If the text field already contains a string representation of a date, AND if it's in a format parseable by JavaScript's Date.parse() method, that date will be used as the hilighted date within the calendar picker.
The grey container and this red paragraph is only here to illustrate this component used in the D7 or PC1 components to give it a grey background color.
Copy the code below and paste into your text editor.
<!-- BEGIN G25 COMPONENT V.3 -->
<div class="g25 g25smlabels">
<form action="" method="post">
<!-- BEGIN DATE FIELD -->
<div class="labeled-input">
<p class="label"><label for="date2">New Date</label></p>
<p class="input">
<input type="text" value="" size="25" id="date2" name="date2" class="jscal" />
</p>
</div>
<!-- END DATE FIELD -->
<div class="radiobuttons">
<p class="label"><label for="contact-email">Contact me via</label></p>
<p class="radiobuttons">
<label><input type="radio" name="contact" value="email" id="contact-email" checked="checked" /> Email</label>
<label><input type="radio" name="contact" value="phone" id="contact-phone" /> Phone</label>
</p>
</div>
<div class="checkboxes">
<p><label><input type="checkbox" /> I agree to the <a href="{linkplaceholder}">license agreement</a></label></p>
<p><label><input type="checkbox" /> Please contact me</label></p>
<p><label><input type="checkbox" /> I am over the age of thirty seven</label></p>
</div>
<div class="hr"><hr /></div>
<div class="submit">
<p>
<input type="submit" class="hotbutton" value="Submit »" />
</p>
</div>
</form>
</div>
<!-- END G25 COMPONENT V.3 -->
No Templates Reference this
v3
x1
JS Calendar Picker Field, Customization Options
You can customize the calendar picker in three ways:
i18n : Month names, weekday names, and the default date format can be customized in menucontent.js.
Start date and end date : You can disable the calendar picker for dates before a certain date after a certain date, or both. The input is coded like this: <input type="text" class="jscal range-foo">. Then somewhere on the page should be an element with id="foo". Within this element, there should be one or both of: <span class="jscal-start">some date here</span> and <span class="jscal-end">some date here</span>. These dates must be parseable by JavaScript's Date.parse() method.
Date format : You can customize the string representation of the date produced by the calendar picker. The default date format is "Mon D, YYYY" (e.g. Dec 25, 2008). More info on date format options . To customize the date format, the input is coded like this: <input type="text" class="jscal format-bar">. Then somewhere on the page should be an element with id="bar", containing the format.
Format: Month D, YYYY
No earlier than: May 13, 2007
No later than: July 20, 2007
The grey container and this red paragraph is only here to illustrate this component used in the D7 or PC1 components to give it a grey background color.
Copy the code below and paste into your text editor.
<!-- BEGIN G25 COMPONENT V.3 -->
<div class="g25 g25smlabels">
<form action="" method="post">
<!-- BEGIN DATE FIELD -->
<div class="labeled-input">
<p class="label"><label for="date">Date Within Range</label></p>
<p class="input">
<input type="text" value="" size="25" id="date" name="date" class="jscal range-myrange format-myformat" />
</p>
</div>
<!-- END DATE FIELD -->
<div class="info">
<p class="help" id="myrange">
Format: <span id="myformat">Month D, YYYY</span><br/>
No earlier than: <span class="jscal-start">May 13, 2007</span><br/>
No later than: <span class="jscal-end">July 20, 2007</span>
</p>
</div>
<div class="hr"><hr /></div>
<div class="submit">
<p>
<input type="submit" class="hotbutton" value="Submit »" />
</p>
</div>
</form>
</div>
<!-- END G25 COMPONENT V.3 -->
No Templates Reference this
v4
Form w/ Show/Hide Based on Selector
<select> elements in a g25 component can be given class "showhide", which triggers show/hide behavior.
Here's an example of the implementation:
<select class="showhide">
<option selected="selected">-- choose one --</option>
<option class="#foo">The Foo Option</option>
<option class="#bar">The Bar Option</option>
<option>The Baz Option</option>
</select>
<span class="hidethis" id="foo">foo is good</span>
<span class="hidethis" id="bar">bar is better</span>
In this example, span#foo and span#bar both start out hidden since they're given class "hidethis".
If the user selects the foo option, span#foo will show.
If the user then selects the bar option, span#foo will hide, and span#bar will show.
If the user then selects the baz option, both span#foo and span#bar will hide.
Note: If JavaScript is disabled, then all sections will show. (e.g. both span#foo and span#bar will show.)
The grey container and this red paragraph is only here to illustrate this component used in the D7 or PC1 components to give it a grey background color.
Copy the code below and paste into your text editor.
<!-- BEGIN G25 COMPONENT V.4 -->
<div class="g25">
<form method="post" action="some.cgi">
<div class="labeled-input">
<p class="label"><label for="foo1">You must choose</label></p>
<p class="input">
<select id="foo1" name="foo1" class="showhide">
<option selected="selected">-- choose one to demonstrate the behavior --</option>
<option class="#foo">The Foo Option</option>
<option class="#bar">The Bar Option</option>
<option>The Baz Option</option>
</select>
<span class="help hidethis" id="foo">foo is good</span>
<span class="help hidethis" id="bar">bar is better</span>
</p>
</div>
<div class="labeled-input">
<p class="label"><label for="foo5">Some Other Field</label></p>
<p class="input"><input type="text" name="foo5" id="foo5" size="30" value="" class="medium" /></p>
</div>
<div class="labeled-input">
<p class="label"><label for="foo6">Yet Another Field</label></p>
<p class="input"><input type="text" name="foo6" id="foo6" size="30" value="" class="medium" /></p>
</div>
</form>
</div>
<!-- END G25 COMPONENT V.4 -->
No Templates Reference this
v4
x1
Form w/ Show/Hide Fields Based on Selector
This example shows the same behavior applied to a section of fields.
The following fields are required if requesting a trial extension:
The grey container and this red paragraph is only here to illustrate this component used in the D7 or PC1 components to give it a grey background color.
Copy the code below and paste into your text editor.
<!-- BEGIN G25 COMPONENT V.4 -->
<div class="g25">
<form method="post" action="some.cgi">
<div class="labeled-input">
<p class="label"><label for="foo1">Query or Comment Type</label></p>
<p class="input">
<select id="foo1" name="foo1" class="showhide">
<option>-- choose one --</option>
<option class="#bar1">Request to Extend 60-Day Trial</option>
<option>Other 1</option>
<option>Other 2</option>
</select>
</p>
</div>
<div id="bar1" class="hidethis">
<div class="hr"><hr/></div>
<p><strong>The following fields are required if requesting a trial extension:</strong></p>
<div class="labeled-input">
<p class="label"><label for="foo2">End User's Company Name</label></p>
<p class="input"><input type="text" name="foo2" id="foo2" size="30" value="" class="medium" /></p>
</div>
<div class="labeled-input">
<p class="label"><label for="foo3">End User's First Name</label></p>
<p class="input"><input type="text" name="foo3" id="foo3" size="30" value="" class="medium" /></p>
</div>
<div class="labeled-input">
<p class="label"><label for="foo4">End User's Last Name</label></p>
<p class="input"><input type="text" name="foo4" id="foo4" size="30" value="" class="medium" /></p>
</div>
<div class="hr"><hr/></div>
</div>
<div class="labeled-input">
<p class="label"><label for="foo5">Some Other Field</label></p>
<p class="input"><input type="text" name="foo5" id="foo5" size="30" value="" class="medium" /></p>
</div>
<div class="labeled-input">
<p class="label"><label for="foo6">Yet Another Field</label></p>
<p class="input"><input type="text" name="foo6" id="foo6" size="30" value="" class="medium" /></p>
</div>
</form>
</div>
<!-- END G25 COMPONENT V.4 -->
No Templates Reference this