blob: ae0c1dd45bc9f444908c49314ec4047594cc12fb [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<ui:composition template="/main.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:tc="http://myfaces.apache.org/tobago/component"
xmlns:ui="http://java.sun.com/jsf/facelets">
<p>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 <code class="language-markup">&lt;tc:form/></code> tag.</p>
<p>Forms are also relevant for
<tc:link label="Default Command"
outcome="/content/20-component/040-command/10-default/Default_Command.xhtml"/>.</p>
<tc:link label="Tag Library Documentation" image="#{request.contextPath}/image/feather-leaf.png"
link="#{apiController.base}/doc/#{apiController.currentRelease}/tld/tc/form.html"/>
<tc:section label="Example">
<p>This small example contain two separate forms, each surrounded by a content box.
The submit button only update the model in the current form.</p>
<pre><code class="language-markup">&lt;tc:box label="Form 1">
&lt;tc:form>
&lt;tc:in label="Value 1" value="\#{formController.value1}"/>
&lt;tc:out label="Value 1 in Model" value="\#{formController.value1}"/>
&lt;tc:button label="Submit"/>
&lt;/tc:form>
&lt;/tc:box>
&lt;tc:box label="Form 2">
...
&lt;/tc:box></code></pre>
<tc:box label="Form 1">
<tc:form id="form1">
<tc:in id="in1" label="Value 1" value="#{formController.value1}"/>
<tc:out id="out1" label="Value 1 in Model" value="#{formController.value1}"/>
<tc:button id="submit1" label="Submit"/>
</tc:form>
</tc:box>
<tc:box label="Form 2">
<tc:form id="form2">
<tc:in id="in2" label="Value 2" value="#{formController.value2}"/>
<tc:out id="out2" label="Value 2 in Model" value="#{formController.value2}"/>
<tc:button id="submit2" label="Submit"/>
</tc:form>
</tc:box>
</tc:section>
</ui:composition>