Class FormGroup

java.lang.Object
org.apache.tapestry5.corelib.mixins.FormGroup

public class FormGroup extends Object
Applied to a Field, this provides the outer layers of markup to correctly render text fields, selects, and textareas using Bootstrap: an outer <div class="field-group"> containing a <label class="control-label"> and the field itself. Actually, the class attribute of the div is defined by the SymbolConstants.FORM_GROUP_WRAPPER_CSS_CLASS and the class attribute of label is defined by the SymbolConstants.FORM_GROUP_LABEL_CSS_CLASS. field-group and control-label are the default values. As with the Label component, the for attribute is set (after the field itself renders). You can also use the SymbolConstants.FORM_GROUP_FORM_FIELD_WRAPPER_ELEMENT_NAME symbol to optionally wrap the input field in an element and SymbolConstants.FORM_GROUP_FORM_FIELD_WRAPPER_ELEMENT_CSS_CLASS to give it a CSS class. This is useful for Bootstrap form-horizontal forms. Setting SymbolConstants.FORM_GROUP_FORM_FIELD_WRAPPER_ELEMENT_NAME to div, SymbolConstants.FORM_GROUP_FORM_FIELD_WRAPPER_ELEMENT_CSS_CLASS to col-sm-10 and SymbolConstants.FORM_GROUP_LABEL_CSS_CLASS to col-sm-2 will generate labels 2 columns wide and form fields 10 columns wide. This component is not appropriate for radio buttons or checkboxes as they use a different class on the outermost element ("radio" or "checkbox") and next the element inside the <label>.
Since:
5.4
See Also:
  • Constructor Details