University of Melbourne home page
 

Text area

Use the text area when you want users to supply a longer text answer.

Syntax

The textarea field has an open and close tag. Default text can be placed between the tags. The name attribute is required for the form processing script to label and identify the input text. The rows and cols refer to the number of characters wide and deep the field will be.

<textarea name="q03" rows="5" cols="30" ></textarea>

Sample

To comply with accessibility guidelines, the field must be explicitly and uniquely identified and labeled, and to work with the template style sheets, some spans and classes must be added.

<label for="q3">
  <span class="question">Here is a text area:</span>
  <span class="answer"><textarea id="q3" name="q3" rows="5" cols="30" ></textarea></span>
</label>

Example


Validation

To enable validation for this type of field you need to add the required class to the label and a span of class required-flag to the question span.

<label for="q3" class="required">
  <span class="question">Here is a text area <span class="required-flag">(required)</span>:</span>
  <span class="answer"><textarea id="q3" name="q3" rows="5" cols="30" ></textarea></span>
</label>
 
html/forms/library/text_area.txt · Last modified: 2007/09/11 15:47 by aharris
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki