Recent changes RSS feed
 

ErrorSummary Tag

<errorsummary> is a compile time component used in conjunction with a form tag. Acts as a container to place form validation errors at runtime. Must be contained by a form element.

Can contain all form errors as a list, or, if the for attribute is used, can deal with errors for individual fields. If you do use the for attribute it should be set to the value of the form field’s displayname attribute (if set) rather than its name or id attribute.

Usage

    <form id="simpleform" action="" method="post">
      <!-- this will list ALL form validation errors -->
      <errorsummary id='Summary'>
        <list:item>
          <span class='error'>{$~ErrorMessage}</span>
          <list:separator><br/></list:separator>
        </list:item>
      </errorsummary>
 
      <p for='firstName' errorclass='error error2'>
        <label for="firstName" errorclass="error error2">First Name:</label>
        <input id="firstName" type="text" name="firstName" displayname='First Name'>
        <!-- This will only display if there are validation errors for the firstName field -->
        <errorsummary id='firstNameSummary' for='First Name'>
          <list:item>
            <span class='error'>{$~ErrorMessage}</span>
          </list:item>
        </errorsummary>
      </p>
 
      <p>
        <label for="lastName" errorclass="error error2">Last Name:</label>
        <input id="lastName" type="text" name="lastName" displayname='Last Name'>
        <!-- This will only display if there are validation errors for the lastName field -->
        <errorsummary id='lastNameSummary' for='Last Name'>
          <list:item>
            <span class='error'>{$~ErrorMessage}</span>
          </list:item>
        </errorsummary>
      </p>
    </form>
 
tag/form/errorsummary.txt · Last modified: 2006/12/09 17:16
 
Hosting for this site donated by Procata PHP Development