FormTagLib (Grails 2.3.8)
Date: 2014-04-24

Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | PROPERTY | CONSTR | METHOD | DETAIL: FIELD | PROPERTY | CONSTR | METHOD

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

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

All Implemented Interfaces:
  org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean

    @Artefact("TagLibrary")
    class FormTagLib
    extends java.lang.Object

Tags for working with form controls.

Authors:
  Graeme Rocher

Property Summary
`groovy.lang.Closure` | `actionSubmit` Creates a submit button that submits to an action in the controller specified by the form action.
`groovy.lang.Closure` | `actionSubmitImage` Creates a an image submit button that submits to an action in the controller specified by the form action.
`org.springframework.context.ApplicationContext` | `applicationContext`
`groovy.lang.Closure` | `checkBox` A helper tag for creating checkboxes.
`org.springframework.core.convert.ConversionService` | `conversionService`
`groovy.lang.Closure` | `currencySelect` A helper tag for creating currency selects.
`groovy.lang.Closure` | `datePicker` A simple date picker that renders a date as selects.
`groovy.lang.Closure` | `field` A general tag for creating fields.
`groovy.lang.Closure` | `form` General linking to controllers, actions etc.
`groovy.lang.Closure` | `hiddenField` Creates a hidden field.
`groovy.lang.Closure` | `localeSelect` A helper tag for creating locale selects.
`groovy.lang.Closure` | `passwordField` Creates a new password field.
`groovy.lang.Closure` | `radio` A helper tag for creating radio buttons.
`groovy.lang.Closure` | `radioGroup` A helper tag for creating radio button groups.
`groovy.lang.Closure` | `renderNoSelectionOption`
`org.springframework.web.servlet.support.RequestDataValueProcessor` | `requestDataValueProcessor`
`groovy.lang.Closure` | `select` A helper tag for creating HTML selects.
`groovy.lang.Closure` | `submitButton` Creates a submit button.
`groovy.lang.Closure` | `textArea` A general tag for creating textareas.
`groovy.lang.Closure` | `textField` Creates a new text field.
`groovy.lang.Closure` | `timeZoneSelect` A helper tag for creating TimeZone selects.
`groovy.lang.Closure` | `uploadForm` Same as <g:form>, except sets the relevant enctype for a file upload form.

Method Summary
`void` | `afterPropertiesSet()`
`java.lang.Object` | `fieldImpl(java.io.Writer out, java.util.Map attrs)`
`java.lang.Object` | `hiddenFieldImpl(java.lang.Object out, java.lang.Object attrs)`
`void` | `outputAttributes(java.util.Map attrs, java.io.Writer writer, boolean useNameAsIdIfIdDoesNotExist = false)` Dump out attributes in HTML compliant fashion.
`java.lang.String` | `processedUrl(java.lang.String link, java.lang.Object request)` Filters the url through the RequestDataValueProcessor bean if it is registered.
`java.lang.Object` | `renderNoSelectionOptionImpl(java.lang.Object out, java.lang.Object noSelectionKey, java.lang.Object noSelectionValue, java.lang.Object value)`
`void` | `resolveAttributes(java.util.Map 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(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), 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

    groovy.lang.Closure 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" />
  emptyTag:
    @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:
    disabled Makes the button to be disabled. Will be interpreted as a Groovy Truth

### actionSubmitImage

    groovy.lang.Closure 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" />
  emptyTag:
    @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
  attr:
    disabled Makes the button to be disabled. Will be interpreted as a Groovy Truth

### applicationContext

    org.springframework.context.ApplicationContext applicationContext

### checkBox

    groovy.lang.Closure checkBox

  A helper tag for creating checkboxes.
  emptyTag:
    @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:
    readonly if evaluates to true, sets to checkbox to read only
  attr:
    id DOM element id; defaults to name

### conversionService

    org.springframework.core.convert.ConversionService conversionService

### currencySelect

    groovy.lang.Closure currencySelect

  A helper tag for creating currency selects.
  eg. <g:currencySelect name="myCurrency" value="${currency}" />
  emptyTag:
    @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

    groovy.lang.Closure datePicker

  A simple date picker that renders a date as selects.
  e.g. <g:datePicker name="myDate" value="${new Date()}" />
  emptyTag:
    @attr name REQUIRED The name of the date picker field set
  attr:
    value The current value of the date picker; defaults to either the value specified by the default attribute or now if no default is set
  attr:
    default A Date or parsable date string that will be used if there is no value
  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:
    relativeYears A range of int representing values relative to value. For example, a relativeYears of -2..7 and a value of today will render a list of 10 years starting with 2 years ago through 7 years in the future. This can be useful for things like credit card expiration dates or birthdates which should be bound relative to today.
  attr:
    id the DOM element id
  attr:
    disabled Makes the resulting inputs and selects to be disabled. Is treated as a Groovy Truth.
  attr:
    readonly Makes the resulting inputs and selects to be made read only. Is treated as a Groovy Truth.

### field

    groovy.lang.Closure field

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

### form

    groovy.lang.Closure form

  General linking to controllers, actions etc. Examples:
  <g:form action="myaction">...</g:form>
  <g:form controller="myctrl" action="myaction">...</g: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'

### hiddenField

    groovy.lang.Closure hiddenField

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

### localeSelect

    groovy.lang.Closure localeSelect

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

### passwordField

    groovy.lang.Closure passwordField

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

### radio

    groovy.lang.Closure radio

  A helper tag for creating radio buttons.
  emptyTag:
    @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:
    readonly boolean to indicate that the radio button should not be editable
  attr:
    id the DOM element id

### radioGroup

    groovy.lang.Closure 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.
  attr:
    disabled Disables the resulting radio buttons.
  attr:
    readonly Makes the resulting radio buttons to not be editable

### renderNoSelectionOption

    groovy.lang.Closure renderNoSelectionOption

### requestDataValueProcessor

    org.springframework.web.servlet.support.RequestDataValueProcessor requestDataValueProcessor

### select

    groovy.lang.Closure 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" />
  emptyTag:
    @attr name REQUIRED the select name
  attr:
    id the DOM element id - uses the name attribute if not specified
  attr:
    from REQUIRED 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)
  attr:
    readonly boolean value indicating whether the select is read only or editable (defaults to false - editable)

### submitButton

    groovy.lang.Closure submitButton

  Creates a submit button.
  emptyTag:
    @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

    groovy.lang.Closure 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

    groovy.lang.Closure textField

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

### timeZoneSelect

    groovy.lang.Closure timeZoneSelect

  A helper tag for creating TimeZone selects.
  eg. <g:timeZoneSelect name="myTimeZone" value="${tz}" />
  emptyTag:
    @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

### uploadForm

    groovy.lang.Closure 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

### afterPropertiesSet

    void afterPropertiesSet()

### fieldImpl

    @groovy.transform.CompileStatic
    java.lang.Object fieldImpl(java.io.Writer out, java.util.Map attrs)

### hiddenFieldImpl

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

### outputAttributes

    @groovy.transform.CompileStatic
    void outputAttributes(java.util.Map attrs, java.io.Writer writer, boolean useNameAsIdIfIdDoesNotExist = false)

  Dump out attributes in HTML compliant fashion.

### processedUrl

    java.lang.String processedUrl(java.lang.String link, java.lang.Object request)

  Filters the url through the RequestDataValueProcessor bean if it is registered.

### 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.util.Map attrs)

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

Groovy Documentation