Jakarta > Tapestry
Jakarta
 
Font size:      

TextField

A form element component that renders an <input> element.

See also: org.apache.tapestry.form.TextField, Form, ValidField

Parameters

Name Type Direction Required Default Default Binding Description
value string in / out yes   ognl The value to be editted, which is is usually a string. Tapestry has limited ability to convert to and from strings.
disabled boolean in no false ognl If true, then a disabled attribute will be rendered as part of the <input> tag, and the component will not update its value parameter when the form is submitted.
displayName string in no   literal The user-presentable name for the component, which will be used by a FieldLabel connected to the component.
hidden boolean in no false ognl If true, then the type attribute will be "password", not "text", and user input in the browser will be masked.

Body: removed

Informal parameters: allowed

Reserved parameters: name, type, value

A TextField may be decorated by the Form's validation delegate, but does not have a validator, so is limited in editting properties types beyond string. In most cases, the ValidField component is preferred.

Example

Below is an excerpt from a Login page, that collects a user id and a password.

Login.html: (partial)

<form jwcid="form@Form" listener="doLogin">
  <table>
    <tr>
      <th>User id:</th>
      <td><input jwcid="userId@TextField" value="userId" size="8"/></td>
    </tr>
    <tr>
      <th>Password:</th>
      <td><input jwcid="password@TextField" value="password" size="8" hidden="true"/></td>
    </tr>
    <tr>
      <td colpsan="2">
        <input type="submit" value="Login"/>
      </td>
    </tr>
  </table>
</form>

Login.java:

public abstract class Login extends BasePage
{
  public abstract String getUserId();
  public abstract String getPassword();
  
  public void doLogin()
  {
    // Talk to back end system, etc.
  }
}