Groovy Documentation

## org.codehaus.groovy.grails.plugins.web.taglib
[Groovy] Class FormTagLib

    java.lang.Object
      org.codehaus.groovy.grails.plugins.web.taglib.FormTagLib

    class FormTagLib

Tags for working with form controls.

Authors:
  Graeme Rocher

Property Summary
`java.lang.Object` | `actionSubmit` Creates a submit button that submits to an action in the controller specified by the form action.
`java.lang.Object` | `actionSubmitImage` Creates a an image submit button that submits to an action in the controller specified by the form action.
`java.lang.Object` | `checkBox` A helper tag for creating checkboxes.
`java.lang.Object` | `currencySelect` A helper tag for creating currency selects.
`java.lang.Object` | `datePicker` A simple date picker that renders a date as selects.
`java.lang.Object` | `field` A general tag for creating fields.
`java.lang.Object` | `form` General linking to controllers, actions etc.
`java.lang.Object` | `grailsApplication`
`java.lang.Object` | `hiddenField` Creates a hidden field.
`java.lang.Object` | `localeSelect` A helper tag for creating locale selects.
`java.lang.Object` | `out`
`java.lang.Object` | `passwordField` Creates a new password field.
`java.lang.Object` | `radio` A helper tag for creating radio buttons.
`java.lang.Object` | `radioGroup` A helper tag for creating radio button groups.
`java.lang.Object` | `renderNoSelectionOption`
`java.lang.Object` | `select` A helper tag for creating HTML selects.
`java.lang.Object` | `submitButton` Creates a submit button.
`java.lang.Object` | `textArea` A general tag for creating textareas.
`java.lang.Object` | `textField` Creates a new text field.
`java.lang.Object` | `timeZoneSelect` A helper tag for creating TimeZone selects.
`java.lang.Object` | `typeConverter`
`java.lang.Object` | `uploadForm` Same as <g:form>, except sets the relevant enctype for a file upload form.

Method Summary
`java.lang.Object` | `fieldImpl(java.lang.Object out, java.lang.Object attrs)`
`java.lang.Object` | `hiddenFieldImpl(java.lang.Object out, java.lang.Object attrs)`
`void` | `outputAttributes(java.lang.Object attrs)` Dump out attributes in HTML compliant fashion.
`java.lang.Object` | `renderNoSelectionOptionImpl(java.lang.Object out, java.lang.Object noSelectionKey, java.lang.Object noSelectionValue, java.lang.Object value)`
`void` | `resolveAttributes(java.lang.Object attrs)` Check required attributes, set the id to name if no id supplied, extract bean values etc.

Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Property Detail

### actionSubmit

    java.lang.Object actionSubmit

  Creates a submit button that submits to an action in the controller specified by the form action.
  The name of the action attribute is translated into the action name, for example "Edit" becomes "_action_edit" or "List People" becomes "_action_listPeople".
  If the action attribute is not specified, the value attribute will be used as part of the action name. <g:actionSubmit value="Edit" />
  <g:actionSubmit action="Edit" value="Some label for editing" />
  attr:
    value REQUIRED The title of the button and name of action when not explicitly defined.
  attr:
    action The name of the action to be executed, otherwise it is derived from the value.

### actionSubmitImage

    java.lang.Object actionSubmitImage

  Creates a an image submit button that submits to an action in the controller specified by the form action. The name of the action attribute is translated into the action name, for example "Edit" becomes "_action_edit" or "List People" becomes "_action_listPeople".
  If the action attribute is not specified, the value attribute will be used as part of the action name.
  <g:actionSubmitImage src="/images/submitButton.gif" action="Edit" />
  attr:
    value REQUIRED The title of the button and name of action when not explicitly defined.
  attr:
    action The name of the action to be executed, otherwise it is derived from the value.
  attr:
    src The source of the image to use

### checkBox

    java.lang.Object checkBox

  A helper tag for creating checkboxes.
  attr:
    name REQUIRED the name of the checkbox
  attr:
    value the value of the checkbox
  attr:
    checked if evaluates to true sets to checkbox to checked
  attr:
    disabled if evaluates to true sets to checkbox to disabled
  attr:
    id DOM element id; defaults to name

### currencySelect

    java.lang.Object currencySelect

  A helper tag for creating currency selects.
  eg. <g:currencySelect name="myCurrency" value="${currency}" />
  attr:
    from The currency symbols to select from, defaults to the major ones if not specified
  attr:
    value The currency value as the currency code. Defaults to the currency for the current Locale if not specified

### datePicker

    java.lang.Object datePicker

  A simple date picker that renders a date as selects.
  e.g. <g:datePicker name="myDate" value="${new Date()}" />
  attr:
    name REQUIRED The name of the date picker field set
  attr:
    value The current value of the date picker; defaults to now if not specified
  attr:
    precision The desired granularity of the date to be rendered
  attr:
    noSelection A single-entry map detailing the key and value to use for the "no selection made" choice in the select box. If there is no current selection this will be shown as it is first in the list, and if submitted with this selected, the key that you provide will be submitted. Typically this will be blank.
  attr:
    years A list or range of years to display, in the order specified. i.e. specify 2007..1900 for a reverse order list going back to 1900. If this attribute is not specified, a range of years from the current year - 100 to current year + 100 will be shown.
  attr:
    id the DOM element id

### field

    java.lang.Object field

  A general tag for creating fields.
  attr:
    type REQUIRED the input type

### form

    java.lang.Object form

  General linking to controllers, actions etc. Examples:
  <g:form action="myaction">...</gr:form>
  <g:form controller="myctrl" action="myaction">...</gr:form>
  attr:
    action the name of the action to use in the link, if not specified the default action will be linked
  attr:
    controller the name of the controller to use in the link, if not specified the current controller will be linked
  attr:
    id The id to use in the link
  attr:
    url A map containing the action,controller,id etc.
  attr:
    name A value to use for both the name and id attribute of the form tag
  attr:
    useToken Set whether to send a token in the request to handle duplicate form submissions. See Handling Duplicate Form Submissions
  attr:
    method the form method to use, either 'POST' or 'GET'; defaults to 'POST'

### grailsApplication

    java.lang.Object grailsApplication

### hiddenField

    java.lang.Object hiddenField

  Creates a hidden field.
  attr:
    name REQUIRED the field name
  attr:
    value the field value

### localeSelect

    java.lang.Object localeSelect

  A helper tag for creating locale selects.
  eg. <g:localeSelect name="myLocale" value="${locale}" />
  attr:
    name REQUIRED The name of the select
  attr:
    value The set locale, defaults to the current request locale if not specified

### out

    java.lang.Object out

### passwordField

    java.lang.Object passwordField

  Creates a new password field.
  attr:
    name REQUIRED the field name
  attr:
    value the field value

### radio

    java.lang.Object radio

  A helper tag for creating radio buttons.
  attr:
    value REQUIRED The value of the radio button
  attr:
    name REQUIRED The name of the radio button
  attr:
    checked boolean to indicate that the radio button should be checked
  attr:
    disabled boolean to indicate that the radio button should be disabled
  attr:
    id the DOM element id

### radioGroup

    java.lang.Object radioGroup

  A helper tag for creating radio button groups.
  attr:
    name REQUIRED The name of the group
  attr:
    values REQUIRED The list values for the radio buttons
  attr:
    value The current selected value
  attr:
    labels Labels for each value contained in the values list. If this is ommitted the label property on the iterator variable (see below) will default to 'Radio ' + value.

### renderNoSelectionOption

    java.lang.Object renderNoSelectionOption

### select

    java.lang.Object select

  A helper tag for creating HTML selects.
  Examples:
  <g:select name="user.age" from="${18..65}" value="${age}" />
  <g:select name="user.company.id" from="${Company.list()}" value="${user?.company.id}" optionKey="id" />
  attr:
    name the select name
  attr:
    id the DOM element id - uses the name attribute if not specified
  attr:
    from The list or range to select from
  attr:
    keys A list of values to be used for the value attribute of each "option" element.
  attr:
    optionKey By default value attribute of each <option> element will be the result of a "toString()" call on each element. Setting this allows the value to be a bean property of each element in the list.
  attr:
    optionValue By default the body of each <option> element will be the result of a "toString()" call on each element in the "from" attribute list. Setting this allows the value to be a bean property of each element in the list.
  attr:
    value The current selected value that evaluates equals() to true for one of the elements in the from list.
  attr:
    multiple boolean value indicating whether the select a multi-select (automatically true if the value is a collection, defaults to false - single-select)
  attr:
    valueMessagePrefix By default the value "option" element will be the result of a "toString()" call on each element in the "from" attribute list. Setting this allows the value to be resolved from the I18n messages. The valueMessagePrefix will be suffixed with a dot ('.') and then the value attribute of the option to resolve the message. If the message could not be resolved, the value is presented.
  attr:
    noSelection A single-entry map detailing the key and value to use for the "no selection made" choice in the select box. If there is no current selection this will be shown as it is first in the list, and if submitted with this selected, the key that you provide will be submitted. Typically this will be blank - but you can also use 'null' in the case that you're passing the ID of an object
  attr:
    disabled boolean value indicating whether the select is disabled or enabled (defaults to false - enabled)

### submitButton

    java.lang.Object submitButton

  Creates a submit button.
  attr:
    name REQUIRED the field name
  attr:
    value the button text
  attr:
    type input type; defaults to 'submit'
  attr:
    event the webflow event id

### textArea

    java.lang.Object textArea

  A general tag for creating textareas.
  attr:
    name REQUIRED the name of the textarea
  attr:
    value the text of the textarea; if not specified renders the body as the text
  attr:
    escapeHtml if true escapes the text as HTML
  attr:
    id DOM element id; defaults to name

### textField

    java.lang.Object textField

  Creates a new text field.
  attr:
    name REQUIRED the field name
  attr:
    value the field value

### timeZoneSelect

    java.lang.Object timeZoneSelect

  A helper tag for creating TimeZone selects.
  eg. <g:timeZoneSelect name="myTimeZone" value="${tz}" />
  attr:
    name REQUIRED The name of the select
  attr:
    value An instance of java.util.TimeZone. Defaults to the time zone for the current Locale if not specified

### typeConverter

    java.lang.Object typeConverter

### uploadForm

    java.lang.Object uploadForm

  Same as <g:form>, except sets the relevant enctype for a file upload form.
  attr:
    action the name of the action to use in the link, if not specified the default action will be linked
  attr:
    controller the name of the controller to use in the link, if not specified the current controller will be linked
  attr:
    id The id to use in the link
  attr:
    url A map containing the action,controller,id etc.
  attr:
    name A value to use for both the name and id attribute of the form tag
  attr:
    useToken Set whether to send a token in the request to handle duplicate form submissions. See Handling Duplicate Form Submissions
  attr:
    method the form method to use, either 'POST' or 'GET'; defaults to 'POST'

Method Detail

### fieldImpl

    java.lang.Object fieldImpl(java.lang.Object out, java.lang.Object attrs)

### hiddenFieldImpl

    java.lang.Object hiddenFieldImpl(java.lang.Object out, java.lang.Object attrs)

### outputAttributes

    void outputAttributes(java.lang.Object attrs)

  Dump out attributes in HTML compliant fashion.

### renderNoSelectionOptionImpl

    java.lang.Object renderNoSelectionOptionImpl(java.lang.Object out, java.lang.Object noSelectionKey, java.lang.Object noSelectionValue, java.lang.Object value)

### resolveAttributes

    void resolveAttributes(java.lang.Object attrs)

  Check required attributes, set the id to name if no id supplied, extract bean values etc.

Groovy Documentation