blob: 2e5b2495bc8f59cea3c11e454ffae474b787b21d [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"
xmlns:f="http://java.sun.com/jsf/core">
<p>The <code class="language-markup">&lt;tc:textarea/&gt;</code> tag, creates a textfield with one or more rows.
The textarea becomes scrollable if the containing text could not displayed in the current size.</p>
<tc:link label="Tag Library Documentation" image="#{request.contextPath}/image/feather-leaf.png" link="#{apiController.base}/doc/#{apiController.currentRelease}/tld/tc/textarea.html"/>
<tc:section label="Basics">
<p>The textarea should always have a label attached. For this, use the <code>label</code> attribute.</p>
<p>Unlike the inputfield TODO:linkToIn there is no placeholder attribute to describe the meaning of a textarea, when no label is set.</p>
<pre><code class="language-markup">&lt;tc:textarea label="Text Area" value="Some text, some text, ..."/&gt;</code></pre>
<tc:textarea id="t1" label="Text Area"
value="Some text, some text, some text, some text, some text, some text, some text, some text, some text, some text, ..."/>
<tc:textarea id="t2" label="Read Only" readonly="true"
value="Some text, some text, some text, some text, some text, some text, some text, some text, some text, some text, ..."/>
<tc:textarea id="t3" label="Disabled" disabled="true"
value="Some text, some text, some text, some text, some text, some text, some text, some text, some text, some text, ..."/>
<tc:textarea id="t4"
value="Text Area without a label, Text Area without a label, Text Area without a label, Text Area without a label, Text Area without a label, Text Area without a label, Text Area without a label, Text Area without a label, Text Area without a label, ..."/>
</tc:section>
<tc:section label="Focus">
<p>The following textarea should be selected after reloading this page. Use the <code>focus</code> attribute.</p>
<pre><code class="language-markup">&lt;tc:textarea label="Text Area (focus)" focus="true" value="Some Text"/&gt;</code></pre>
<tc:textarea id="t5" label="Text Area (focus)" focus="true" value="Some Text"/>
</tc:section>
<tc:section label="Required">
<p>A textarea can be set as required with the <code>required</code> attribute.
Such a textarea 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">&lt;tc:textarea id="treq" label="Text Area" required="true"/></code></pre>
<tc:textarea id="treq" label="Text Area" required="true"/>
<tc:button label="Submit" action="#{textareaController.submit}"/>
</tc:section>
<tc:section label="Ajax">
<p>Ajax update by the change event:</p>
<tc:textarea id="tajax" label="Text Area" value="#{textareaController.ajaxValue}">
<f:ajax render="outputAjax" />
</tc:textarea>
<tc:out id="outputAjax" label="On Server" value="#{textareaController.ajaxValue}"/>
</tc:section>
<tc:section label="Rows">
<p>With the <code>rows</code> attribute, the initial size of the textbox can be set. A value less than 1 has no effect.</p>
<p>The following example show a textarea with five rows.</p>
<pre><code class="language-markup">&lt;tc:textarea label="Text Area" rows="5" value="\#{textareaController.longText}"/&gt;</code></pre>
<tc:textarea id="t6" label="Text Area" rows="5" value="#{textareaController.longText}"/>
</tc:section>
</ui:composition>