| <?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"> |
| |
| <p>The <code class="language-markup"><tc:in/></code> tag create a classic inputfield.</p> |
| <tc:link label="Tag Library Documentation" image="#{request.contextPath}/image/feather-leaf.png" link="#{apiController.base}/doc/#{apiController.currentRelease}/tld/tc/in.html"/> |
| <tc:section label="Basics"> |
| <p>In most cases, a label should be placed in front of every inputfield. Use the attribute |
| <code>label</code>.</p> |
| <pre><code class="language-markup"><tc:in label="Input" value="Some Text"/></code></pre> |
| <tc:in id="iNormal" label="Input" value="Some Text"/> |
| <tc:in id="ireadonly" label="Read Only" readonly="true" value="Some Text"/> |
| <tc:in id="i3" label="Disabled" disabled="true" value="Some Text"/> |
| <tc:in id="i4" value="Input without a label"/> |
| </tc:section> |
| |
| <tc:section label="Focus"> |
| <p>The following inputfield should be selected after reloading the page. Use the <code>focus</code> attribute.</p> |
| <pre><code class="language-markup"><tc:in label="Input (focus)" focus="true" value="Some Text"/></code></pre> |
| <tc:in id="i5" label="Input (focus)" focus="true" value="Some Text"/> |
| </tc:section> |
| |
| <tc:section label="Required"> |
| <p>An inputfield can be set as required with the <code>required</code> attribute. |
| Such an inputfield must contain a value, otherwise a submit is not possible. |
| Leave the field blank and press 'submit' to see the errormessage.</p> |
| <pre><code class="language-markup"><tc:in label="Input (required)" required="true"/></code></pre> |
| <tc:in id="ireq" label="Input (required)" required="true" value="#{inController.requiredValue}"/> |
| <tc:button label="Submit"/> |
| </tc:section> |
| |
| <tc:section label="Help"> |
| <p>A help text can be added with the <code>help</code> attribute.</p> |
| <pre><code class="language-markup"><tc:in help="\#{inController.helpText}"/></code></pre> |
| <tc:in help="#{inController.helpText}"/> |
| </tc:section> |
| |
| <tc:section label="Password"> |
| <p>To create an inputfield for passwords, set the |
| <code>password</code> attribute to 'true'. It will hide the text as shown in the following example.</p> |
| <pre><code id="c3" |
| class="language-markup"><tc:in label="Password" password="true" value="password"/></code></pre> |
| <tc:in id="i6" label="Password" password="true" value="password"/> |
| </tc:section> |
| |
| <tc:section label="Placeholder"> |
| <p>A <code>placeholder</code> attribute can be used for explaining a user the meaning of a field.</p> |
| <p>The text of the placeholder is only shown if the value is an empty string.</p> |
| <pre><code class="language-markup"><tc:in label="Placeholder" placeholder="Grey Text"/></code></pre> |
| <tc:in id="i7" label="Placeholder" placeholder="Short description of the field." /> |
| </tc:section> |
| |
| <tc:section label="Ajax"> |
| <p>The outputfield in this example, displays the given value on the server. |
| With <code class="language-markup"><f:ajax render="outputAjax" listener="\#{inController.update}"/></code>, |
| the outputfield will be rerendered, after the value has been changed. |
| This is because <code>outputAjax</code> is the id of the <code><tc:out/></code> tag. |
| and the default event for <code class="language-markup"><tc:in/></code> is <code>change</code>. |
| |
| Additional, the <code>listener</code> attribute is set. The given method is called after the inputfield |
| loose focus.</p> |
| <tc:in id="inputAjax" label="On Change" value="#{inController.changeValue}"> |
| <f:ajax render="outputAjax" listener="#{inController.update}"/> |
| </tc:in> |
| <tc:out id="outputAjax" label="On Server" value="#{inController.changeValue}"/> |
| </tc:section> |
| </ui:composition> |