org.appng.taglib.form

## Class FormGroup

- java.lang.Object
- - javax.servlet.jsp.tagext.TagSupport
  - - javax.servlet.jsp.tagext.BodyTagSupport
    - - org.appng.taglib.form.FormGroup

- All Implemented Interfaces:
    Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag

      public class FormGroup
      extends javax.servlet.jsp.tagext.BodyTagSupport

  An `<appNG:formGroup>` can contain multiple `<appNG:formElement>`s. The elements of a group are implicitly enclosed with a `<div>` container whose `style` attribute can be set using the `styleClass` attribute of the taglet.

  Attributes:
  All of the following attributes are optional.
  - name - the name of the input element(s) this group refers to
  - mandatory - set to `true` if the field is mandatory
  - mandatoryMessage - the message to be displayed when no value has been entered for a mandatory field
  - errorMessage - the error message to be displayed when validation fails
  - errorClass - the CSS class to add to enclosing `<div>` and the element(s) with the given name when validation fails
  - errorElementId - the id of a nested element to append a `<span>` with the error message
  - styleClass -a CSS class for the enclosing `<div>`
  Usage:

       Favorite number:<br/>
       <appNG:formGroup name="select" styleClass="group" mandatory="true" mandatoryMessage="Please make your selection!" errorClass="error" errorElementId="numberError">
         <select name="select">
           <appNG:formElement>
             <option value="42">42</option>
           </appNG:formElement>
           <appNG:formElement>
             <option value="0815">0815</option>
           </appNG:formElement>
           <appNG:formElement>
             <option value="1701">1701</option>
           </appNG:formElement>
         </select>
       </appNG:formGroup>
       <div id="numberError"></div>

  Output (before submitting):

       Favorite number:<br/>
       <div class="group">
         <select name="select">
           <option value="42">42</option>
           <option value="0815">0815</option>
           <option value="1701">1701</option>
         </select>
         <div id="numberError"></div>
       </div>

  Output (after submitting, nothing selected):

       Favorite number:<br/>
       <div class="group error">
         <select name="select" class="error">
           <option value="42">42</option>
           <option value="0815">0815</option>
           <option value="1701">1701</option>
         </select>
        <div id="numberError"><span>Please make your selection!</span></div>
       </div>

  Author:
    Matthias Müller
  See Also:
    `FormElement`, `Form`, Serialized Form

- - ### Field Summary

    - ### Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport

      `bodyContent`

    - ### Fields inherited from class javax.servlet.jsp.tagext.TagSupport

      `id, pageContext`

    - ### Fields inherited from interface javax.servlet.jsp.tagext.BodyTag

      `EVAL_BODY_BUFFERED, EVAL_BODY_TAG`

    - ### Fields inherited from interface javax.servlet.jsp.tagext.IterationTag

      `EVAL_BODY_AGAIN`

    - ### Fields inherited from interface javax.servlet.jsp.tagext.Tag

      `EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FormGroup()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `doAfterBody()`
    `int` | `doStartTag()`
    `String` | `getErrorClass()`
    `String` | `getErrorElementId()`
    `String` | `getErrorMessage()`
    `FormData` | `getFormData()`
    `String` | `getMandatoryMessage()`
    `String` | `getName()`
    `String` | `getStyleClass()`
    `protected FormGroup` | `getWrappedFormGroup()`
    `boolean` | `isMandatory()`
    `boolean` | `isMultiple()`
    `void` | `release()`
    `void` | `setErrorClass(String errorClass)`
    `void` | `setErrorElementId(String errorElementId)`
    `void` | `setErrorMessage(String errorMessage)`
    `void` | `setMandatory(boolean mandatory)`
    `void` | `setMandatoryMessage(String mandatoryMessage)`
    `void` | `setMultiple(boolean multiple)`
    `void` | `setName(String name)`
    `void` | `setStyleClass(String styleClass)`

    - ### Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport

      `doEndTag, doInitBody, getBodyContent, getPreviousOut, setBodyContent`

    - ### Methods inherited from class javax.servlet.jsp.tagext.TagSupport

      `findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface javax.servlet.jsp.tagext.Tag

      `getParent, setPageContext, setParent`

- - ### Constructor Detail

    - #### FormGroup

          public FormGroup()

  - ### Method Detail

    - #### doStartTag

          public int doStartTag()
                         throws javax.servlet.jsp.JspException

      Specified by:
        `doStartTag` in interface `javax.servlet.jsp.tagext.Tag`
      Overrides:
        `doStartTag` in class `javax.servlet.jsp.tagext.BodyTagSupport`
      Throws:
        `javax.servlet.jsp.JspException`

    - #### doAfterBody

          public int doAfterBody()
                          throws javax.servlet.jsp.JspException

      Specified by:
        `doAfterBody` in interface `javax.servlet.jsp.tagext.IterationTag`
      Overrides:
        `doAfterBody` in class `javax.servlet.jsp.tagext.BodyTagSupport`
      Throws:
        `javax.servlet.jsp.JspException`

    - #### release

          public void release()

      Specified by:
        `release` in interface `javax.servlet.jsp.tagext.Tag`
      Overrides:
        `release` in class `javax.servlet.jsp.tagext.BodyTagSupport`

    - #### getWrappedFormGroup

          protected FormGroup getWrappedFormGroup()

    - #### getFormData

          public FormData getFormData()

    - #### getErrorClass

          public String getErrorClass()

    - #### setErrorClass

          public void setErrorClass(String errorClass)

    - #### getStyleClass

          public String getStyleClass()

    - #### setStyleClass

          public void setStyleClass(String styleClass)

    - #### getName

          public String getName()

    - #### setName

          public void setName(String name)

    - #### isMandatory

          public boolean isMandatory()

    - #### setMandatory

          public void setMandatory(boolean mandatory)

    - #### isMultiple

          public boolean isMultiple()

    - #### setMultiple

          public void setMultiple(boolean multiple)

    - #### getMandatoryMessage

          public String getMandatoryMessage()

    - #### setMandatoryMessage

          public void setMandatoryMessage(String mandatoryMessage)

    - #### getErrorElementId

          public String getErrorElementId()

    - #### setErrorElementId

          public void setErrorElementId(String errorElementId)

    - #### getErrorMessage

          public String getErrorMessage()

    - #### setErrorMessage

          public void setErrorMessage(String errorMessage)

Copyright © 2011–2023 aiticon GmbH. All rights reserved.