Tobago Demo

Menu

Root Dummy Intro Search Getting Started Docker What's New Migration Compatibility FAQ API Download Server Info Logging Info In Suggest Textarea Date Range Group 5 Star Rating File Upload Out Label Badge Image Figure Progress Object Checkbox Toggle Dropdown Radio Listbox SelectOneList Multi Checkbox Multi Listbox Shuttle SelectManyList Button and Link Default Command Button Group Customizer Link Group Box Panel Separator Section Header and Footer Bar Popup Popover Toast Basic example Tab Client Tab Ajax Tab Server Basic example Sheet Sorting Paginator Sheet Column Selector Sheet Selectionchange Sheet Event Sheet Action Sheet Markup Sheet Style Empty Sheet Column Bar Sheet Filter Sheet Static Header Sheet Multi Header Sheet Tree Column Panel Sheet Editable Sheet Lazy Sheet Nested Basic example Tree Command Types Tree Select Tree Editor Tree Menu Tree Listbox Intro TinyMCE CKEditor Flow Layout Flex Layout Segment Layout Label Layout Grid Layout Split Layout Message-layout Overview Collapsible Box Collapsible Popup Collapsible Panel Collapsible Section Content Validation JSR 303 Severity Messages Content Security Policy Sanitize Roles Form AccessKey Focus Exception Handler Style Tag Bootstrap Theme Icons Partial Ajax Behavior WebSocket Transition Non Faces Request Conversion Error Handling For Each ConversationScoped Download Configuration Format Locale DataAttribute Meta
Root Dummy Intro Search Getting Started Docker What's New Migration Compatibility FAQ API Download Server Info Logging Info In Suggest Textarea Date Range Group 5 Star Rating File Upload Out Label Badge Image Figure Progress Object Checkbox Toggle Dropdown Radio Listbox SelectOneList Multi Checkbox Multi Listbox Shuttle SelectManyList Button and Link Default Command Button Group Customizer Link Group Box Panel Separator Section Header and Footer Bar Popup Popover Toast Basic example Tab Client Tab Ajax Tab Server Basic example Sheet Sorting Paginator Sheet Column Selector Sheet Selectionchange Sheet Event Sheet Action Sheet Markup Sheet Style Empty Sheet Column Bar Sheet Filter Sheet Static Header Sheet Multi Header Sheet Tree Column Panel Sheet Editable Sheet Lazy Sheet Nested Basic example Tree Command Types Tree Select Tree Editor Tree Menu Tree Listbox Intro TinyMCE CKEditor Flow Layout Flex Layout Segment Layout Label Layout Grid Layout Split Layout Message-layout Overview Collapsible Box Collapsible Popup Collapsible Panel Collapsible Section Content Validation JSR 303 Severity Messages Content Security Policy Sanitize Roles Form AccessKey Focus Exception Handler Style Tag Bootstrap Theme Icons Partial Ajax Behavior WebSocket Transition Non Faces Request Conversion Error Handling For Each ConversationScoped Download Configuration Format Locale DataAttribute Meta

Form

Tobago supports nested forms and can treat each form separately. Values can be stored separately into the model, while already filled input elements keep their values (temporarily). Forms are added by the <tc:form/> tag.

Forms are also relevant for Default Command.

Tag Library Documentation

Example

This small example contain two separate forms, each surrounded by a content box. The submit button only update the model in the current form.

<tc:box label="Form 1"> <tc:form> <tc:in label="Value 1" value="#{formController.value1}"/> <tc:out label="Value 1 in Model" value="#{formController.value1}"/> <tc:button label="Submit"/> </tc:form> </tc:box> <tc:box label="Form 2"> ... </tc:box>

Form 1

Form 2

Required

If the validation of a form is activated and the actual value of this form is only stored temporarily, the validation is deactivated until the value is definitely stored into the model.

For example, if only the value in 'Inner Form 1' is set, the validation of the other forms are turned off.

Tag Library Documentation

Example

Every form in this example is surrounded by a content box. The submit buttons in the inner forms only put the inner value into the model. The submit button in the outer form put all values into the model. The validation for the inner value 2 and for the outer value is activated, both fields are required.

<tc:box label="Outer Form"> <tc:form> <tc:box label="Inner Form 1"> <tc:form> <tc:in label="Inner Value 1"/> <tc:out label="Inner Value 1 in Model"/> <tc:button label="Submit"/> </tc:form> </tc:box> <tc:box label="Inner Form 2"> ... </tc:box> <tc:separator/> <tc:in label="Outer Value" required="true"/> <tc:out label="Outer Value in Model"/> <tc:button label="Submit"/> </tc:form> </tc:box>

Outer Form

Inner Form 1

Inner Form 2


Ajax

The <f:ajax execute="..." render="..."/> tag ignore the <tc:form> tag. The form is only used as a naming container.

Tag Library Documentation

Example

The structure of this example is similar to the Form Required example. Every form in this example is surrounded by a content box. The submit buttons in the inner forms only put the inner value into the model. The submit button in the outer form put all values into the model. The validation for the inner value 2 and for the outer value is activated, both fields are required.

There are also two more submit buttons in the outer form. The 'Inner Forms' button submit both values in the inner forms. The 'Outer Value' button only submit the outer value. Please notice, that all buttons use the <f:ajax execute="..." render="..."/> tag.

Also note, that the <tc:message/> tag has to be rerendered to show error messages.

<tc:box label="Outer Form"> <tc:form> <tc:box label="Inner Form 1"> <tc:form> <tc:in label="Inner Value 1"/> <tc:out label="Inner Value 1 in Model"/> <tc:button label="Submit"> <f:ajax execute="in" render="in out :page:messages"/> </tc:button> </tc:form> </tc:box> <tc:box label="Inner Form 2"> ... </tc:box> <tc:separator/> <tc:in label="Outer Value" required="true"/> <tc:out label="Outer Value in Model"/> <tc:button label="Submit"> <f:ajax execute="::form1:in ::form2:in in" render="::form1:in ::form2:in in ::form1:out ::form2:out out :page:messages"/> </tc:button> ... </tc:form> </tc:box>

Outer Form

Inner Form 1

Inner Form 2



Submit only:
© 2005-2025 Apache Software Foundation, Licensed under the Apache License, Version 2.0.