TextField

This is a variant from the TextField component which is built into tapestry. It is fully equivalent, apart from two parameters which have been added to provide ajax capabilities.

Similar to the functioning of ActionLink you can add "zone" and "context" parameters. When the value in the text field looses focus, the zone will be updated using an ajax call to the server.

A simple example is included below. This will do some transformation on the text (on the server side) which is displayed in an ajax call.

Note that the reference which is called is automatically changed into a single space when empty. Otherwise a second onChangeFromTextField2 method would be needed to handle this case.


<t:block t:id="tf2Block">${tf2Value}</t:block>
<span t:type="equanda/TextField" t:id="TextField2" value="tf2Value" zone="tf2zone" context="literal: --- "/>
<t:zone t:id="tf2zone"/>

@Inject
@Property
private Block tf2Block;

@Property
private String tf2Value;

Block onChangeFromTextfield2( String infix, String str )
{
if ( " ".equals( str ) ) { /* special handling when textbox was empty */ }
tf2Value = infix;
tf2Value = str.toLowerCase() + infix + str.toUpperCase();
return tf2Block;
}
  • 1. TextField