The <tc:in/>
tag create a classic inputfield.
In most cases, a label should be placed in front of every inputfield. Use the attribute
label
.
<tc:in label="Input" value="Some Text"/>
The following inputfield should be selected after reloading the page. Use the focus
attribute.
<tc:in label="Input (focus)" focus="true" value="Some Text"/>
An inputfield can be set as required with the required
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.
<tc:in label="Input (required)" required="true"/>
To create an inputfield for passwords, set the
password
attribute to 'true'. It will hide the text as shown in the following example.
<tc:in label="Password" password="true" value="password"/>
A placeholder
attribute can be used for explaining a user the meaning of a field.
The text of the placeholder is only shown if the value is an empty string.
<tc:in label="Placeholder" placeholder="Grey Text"/>
The outputfield in this example, displays the given value on the server.
With <f:ajax render="outputAjax" listener="\#{inController.update}"/>
,
the outputfield will be rerendered, after the value has been changed.
This is because outputAjax
is the id of the <tc:out/>
tag.
and the default event for <tc:in/>
is change
.
Additional, the listener
attribute is set. The given method is called after the inputfield
loose focus.