blob: 8fbed525b92bbdb6f91cf0f727d3aff6f62f8165 [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://xmlns.jcp.org/jsf/facelets">
<p>This page contain some examples for the collapsible concept of a popup. Please have a look at the
<tc:link label="Popup" outcome="/content/20-component/060-popup/Popup.xhtml"/>
page in the components section for more details.</p>
<tc:section label="Simple Popup">
<tc:form id="simple">
<p>A popup opened with the help of a controller. The popup contain a required input field.
The attribute <code>collapsedMode="absent"</code> is set,
so the 'Submit'-button outside the popup could be executed while popup is hidden.
Even if the required input field is empty.</p>
<tc:button id="open1" label="Open" action="#{collapsiblePopupController.open}"/>
<tc:button id="submitOnPage1" label="Submit"/>
<tc:popup id="controllerPopup" collapsed="#{collapsiblePopupController.collapsed}">
<tc:box label="Simple Popup">
<tc:in id="in1" label="Required" required="true"/>
<tc:button id="submitOnPopup1" label="Submit"/>
<tc:button id="close1" label="Close" immediate="true" action="#{collapsiblePopupController.close}"/>
</tc:box>
</tc:popup>
</tc:form>
</tc:section>
<tc:section label="Full Server Request">
<tc:form id="server">
<p>Server side popup with <code class="language-markup">&lt;tc:operation/></code>.
The attribute <code>collapsedMode="absent"</code> is set by default.
If you press the 'Submit'-button in the popup, the popup remains open,
because the server know the current state.</p>
<tc:button id="open2" label="Open">
<tc:operation name="show" for="fullServerRequestPopup"/>
</tc:button>
<tc:button id="submitOnPage2" label="Submit"/>
<tc:popup id="fullServerRequestPopup">
<tc:box label="Full Server Request">
<tc:in id="in2" label="Required" required="true"/>
<tc:button id="submitOnPopup2" label="Submit"/>
<tc:button id="close2" label="Close" immediate="true">
<tc:operation name="hide" for="fullServerRequestPopup"/>
</tc:button>
</tc:box>
</tc:popup>
</tc:form>
</tc:section>
<tc:section label="Client Side">
<tc:form id="client">
<p>For the client side popup the attribute <code>collapsedMode="hidden"</code> must be set.
So the hidden popup is already rendered on the site. Otherwise a client side opened popup has no content.</p>
<p>This leads to the problem of violations of hidden content.
In this case you cannot press the 'Submit'-button if the required field is empty.
Even if the popup is hidden.</p>
<p>The 'Submit'-button in the popup will close the popup, because the server didn't know the current state.</p>
<p>To avoid server request, the attribute <code>omit="true"</code>
is added to the 'Open'-button and the 'Close'-button.</p>
<tc:button id="open3" label="Open" omit="true">
<tc:operation name="show" for="clientPopup"/>
</tc:button>
<tc:button id="submitOnPage3" label="Submit"/>
<tc:popup id="clientPopup" collapsedMode="hidden">
<tc:box label="Full Server Request">
<p>The opening of the popup is client side.
Therefor the popup will be closed after pressing the 'Submit'-button which reload the page.</p>
<tc:in id="in3" label="Required" required="true"/>
<tc:button id="submitOnPopup3" label="Submit"/>
<tc:button id="close3" label="Close" omit="true">
<tc:operation name="hide" for="clientPopup"/>
</tc:button>
</tc:box>
</tc:popup>
</tc:form>
</tc:section>
</ui:composition>