Section <tc:section>

Collapsible concept explained for a Section.

Simple Section

A simple collapsible section. The collapsed attribute is set by a controller. The 'hide'-button got immediate="true" to submitting without validation.

The collapsedMode="absent" is set. The 'Submit'-button can be executed without violation if the content of section is hidden.

Collapsible Section

Full Server Request

The state is changed by <tc:operation/> with a full server request. The attribute immediate="true" is set for the 'hide'-button to change the state without validating the inputfield.

The collapsedMode="absent" is set. The 'Submit'-button can be executed without violation if the content of section is hidden.

Collapsible Section

Client Side

In this example opening and closing is done by the client. The attribute omit="true" set for the 'show'-button and the 'hide'-button to prevent submitting.

For the section collapsedMode="hidden" is set. After the 'hide' transition, the content of the section will be in the 'hidden' state. The hidden content of the section will also be validated.
If the 'Submit'-button is pressed while the inputfield is empty, a violation occurs.

Collapsible Section

Ajax

The show and hide transitions are run with an ajax request. The 'hide'-button got immediate="true" to submitting without validation.

The collapsedMode="absent" is set. The 'Submit'-button can be executed without violation if the content of section is hidden.

Collapsible Section

<?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" xmlns:f="http://java.sun.com/jsf/core"> <ui:param name="title" value="#{demoBundle.collapsible_section} &lt;tc:section>"/> <p>Collapsible concept explained for a <tc:link label="#{demoBundle.section}" outcome="/content/20-component/050-container/40-section/section.xhtml"/>.</p> <tc:section label="Simple Section"> <p>A simple collapsible section. The <code>collapsed</code> attribute is set by a controller. The 'hide'-button got <code>immediate="true"</code> to submitting without validation.</p> <p>The <code>collapsedMode="absent"</code> is set. The 'Submit'-button can be executed without violation if the content of section is hidden.</p> <tc:form id="simple"> <tc:button id="submitSimple" label="Submit"/> <tc:section id="simpleSection" label="Collapsible Section" collapsed="#{collapsibleSectionController.collapsed}" collapsedMode="absent"> <f:facet name="bar"> <tc:buttons> <tc:button id="showSimple" label="show" action="#{collapsibleSectionController.show}"/> <tc:button id="hideSimple" label="hide" action="#{collapsibleSectionController.hide}" immediate="true"/> </tc:buttons> </f:facet> <tc:in id="inSimple" label="Required" required="true"/> </tc:section> </tc:form> </tc:section> <tc:section label="Full Server Request"> <p>The state is changed by <code class="language-markup">&lt;tc:operation/></code> with a full server request. The attribute <code>immediate="true"</code> is set for the 'hide'-button to change the state without validating the inputfield.</p> <p>The <code>collapsedMode="absent"</code> is set. The 'Submit'-button can be executed without violation if the content of section is hidden.</p> <tc:form id="server"> <tc:button id="submitServer" label="Submit"/> <tc:section id="fullRequestSection" label="Collapsible Section" collapsedMode="absent"> <f:facet name="bar"> <tc:buttons> <tc:button id="showServer" label="show"> <tc:operation name="show" for="fullRequestSection"/> </tc:button> <tc:button id="hideServer" label="hide" immediate="true"> <tc:operation name="hide" for="fullRequestSection"/> </tc:button> </tc:buttons> </f:facet> <tc:in id="inServer" label="Required" required="true"/> </tc:section> </tc:form> </tc:section> <tc:section label="Client Side"> <p>In this example opening and closing is done by the client. The attribute <code>omit="true"</code> set for the 'show'-button and the 'hide'-button to prevent submitting.</p> <p>For the section <code>collapsedMode="hidden"</code> is set. After the 'hide' transition, the content of the section will be in the 'hidden' state. The hidden content of the section will also be validated.<br/> If the 'Submit'-button is pressed while the inputfield is empty, a violation occurs.</p> <tc:form id="client"> <tc:button id="submitClient" label="Submit"/> <tc:section id="clientSection" label="Collapsible Section" collapsedMode="hidden"> <f:facet name="bar"> <tc:buttons> <tc:button id="showClient" label="show" omit="true"> <tc:operation name="show" for="clientSection"/> </tc:button> <tc:button id="hideClient" label="hide" omit="true"> <tc:operation name="hide" for="clientSection"/> </tc:button> </tc:buttons> </f:facet> <tc:in id="inClient" label="Required" required="true"/> </tc:section> </tc:form> </tc:section> <tc:section label="Ajax"> <p>The show and hide transitions are run with an ajax request. The 'hide'-button got <code>immediate="true"</code> to submitting without validation.</p> <p>The <code>collapsedMode="absent"</code> is set. The 'Submit'-button can be executed without violation if the content of section is hidden.</p> <tc:form id="ajax"> <tc:button id="submitAjax" label="Submit"/> <tc:section id="ajaxSection" label="Collapsible Section" collapsedMode="absent"> <f:facet name="bar"> <tc:buttons> <tc:button id="showAjax" label="show"> <f:ajax execute="ajaxSection" render="ajaxSection"/> <tc:operation name="show" for="ajaxSection"/> </tc:button> <tc:button id="hideAjax" label="hide" immediate="true"> <f:ajax execute="ajaxSection" render="ajaxSection"/> <tc:operation name="hide" for="ajaxSection"/> </tc:button> </tc:buttons> </f:facet> <tc:in id="inAjax" label="Required" required="true"/> </tc:section> </tc:form> </tc:section> </ui:composition>