Home > Guides > Tag Developers Guide > Struts Tags > Tag Reference > UI Tag Reference > form

Please make sure you have read the Tag Syntax document and understand how tag attribute syntax works.

Description

Renders HTML an input form.

The remote form allows the form to be submitted without the page being refreshed. The results from the form can be inserted into any HTML element on the page.

NOTE:
The order / logic in determining the posting url of the generated HTML form is as follows:

  1. If the action attribute is not specified, then the current request will be used to determine the posting url
  2. If the action is given, Struts will try to obtain an ActionConfig. This will be successful if the action attribute is a valid action alias defined struts.xml.
  3. If the action is given and is not an action alias defined in struts.xml, Struts will used the action attribute as if it is the posting url, separting the namespace from it and using UrlHelper to generate the final url.

Parameters

Dynamic Attributes Allowed:

true
 

Name

Required

Default

Evaluated

Type

Description

acceptcharsetfalsefalseStringThe accepted charsets for this form. The values may be comma or blank delimited.
accesskeyfalsefalseStringSet the html accesskey attribute on rendered html element
actionfalsecurrent actionfalseStringSet action name to submit to, without .action suffix
classfalsefalseStringThe css class to use for element - it's an alias of cssClass attribute.
cssClassfalsefalseStringThe css class to use for element
cssErrorClassfalsefalseStringThe css error class to use for element
cssErrorStylefalsefalseStringThe css error style definitions for element to use
cssStylefalsefalseStringThe css style definitions for element to use
disabledfalsefalseStringSet the html disabled attribute on rendered html element
enctypefalsefalseStringHTML form enctype attribute
errorPositionfalsefalseStringDefine error position of form element (top|bottom)
focusElementfalsefalseStringId of element that will receive the focus when page loads.
idfalsefalseStringHTML id attribute
includeContextfalsetruefalseBooleanWhether actual context should be included in URL
javascriptTooltipfalsefalsefalseBooleanUse JavaScript to generate tooltips
keyfalsefalseStringSet the key (name, value, label) for this particular component
labelfalsefalseStringLabel expression used for rendering an element specific label
labelSeparatorfalse:falseStringString that will be appended to the label
labelpositionfalsefalseStringDefine label position of form element (top/left)
methodfalsefalseStringHTML form method attribute
namefalsefalseStringThe name to set for element
namespacefalsecurrent namespacefalseStringNamespace for action to submit to
onblurfalsefalseString Set the html onblur attribute on rendered html element
onchangefalsefalseStringSet the html onchange attribute on rendered html element
onclickfalsefalseStringSet the html onclick attribute on rendered html element
ondblclickfalsefalseStringSet the html ondblclick attribute on rendered html element
onfocusfalsefalseStringSet the html onfocus attribute on rendered html element
onkeydownfalsefalseStringSet the html onkeydown attribute on rendered html element
onkeypressfalsefalseStringSet the html onkeypress attribute on rendered html element
onkeyupfalsefalseStringSet the html onkeyup attribute on rendered html element
onmousedownfalsefalseStringSet the html onmousedown attribute on rendered html element
onmousemovefalsefalseStringSet the html onmousemove attribute on rendered html element
onmouseoutfalsefalseStringSet the html onmouseout attribute on rendered html element
onmouseoverfalsefalseStringSet the html onmouseover attribute on rendered html element
onmouseupfalsefalseStringSet the html onmouseup attribute on rendered html element
onresetfalsefalseStringHTML onreset attribute
onselectfalsefalseStringSet the html onselect attribute on rendered html element
onsubmitfalsefalseStringHTML onsubmit attribute
openTemplatefalsefalseStringSet template to use for opening the rendered html.
portletModefalsefalseStringThe portlet mode to display after the form submit
requiredLabelfalsefalsefalseBooleanIf set to true, the rendered element will indicate that input is required
requiredPositionfalsefalseStringDefine required position of required form element (left|right)
stylefalsefalseStringThe css style definitions for element to use - it's an alias of cssStyle attribute.
tabindexfalsefalseStringSet the html tabindex attribute on rendered html element
targetfalsefalseStringHTML form target attribute
templatefalsefalseStringThe template (other than default) to use for rendering the element
templateDirfalsefalseStringThe template directory.
themefalsefalseStringThe theme (other than default) to use for rendering the element
titlefalsefalseStringSet the html title attribute on rendered html element
tooltipfalsefalseStringSet the tooltip of this particular component
tooltipConfigfalsefalseStringDeprecated. Use individual tooltip configuration attributes instead.
tooltipCssClassfalseStrutsTTClassicfalseStringCSS class applied to JavaScrip tooltips
tooltipDelayfalseClassicfalseStringDelay in milliseconds, before showing JavaScript tooltips
tooltipIconPathfalsefalseStringIcon path used for image that will have the tooltip
validatefalsefalsefalseBooleanWhether client side/remote validation should be performed. Only useful with theme xhtml/ajax
valuefalsefalseStringPreset the value of input element.
windowStatefalsefalseStringThe window state to display after the form submit

Examples

Validation

There are two flavours Client Side Validation, depending on the theme you are using (xhtml, ajax, etc). If you are using the xhtml theme or css_xhtml theme, pure client side validation will be used. If you are using the ajax theme, a special AJAX-based validation will take place. Read the Client Side Validation docs for more information.