In Tapestry 3.0, I was able to show a text field when a field wasn't
populated, then hide it when it was.
<tr>
<th>
<label jwcid="@FieldLabel"
field="ognl:components.usernameField">Username</label>
</th>
<td style="height: 20px">
<div jwcid="@contrib:FormConditional"
condition="ognl:user.version == null">
<input jwcid="usernameField" type="text" id="username"/>
</div>
<div jwcid="@contrib:FormConditional"
condition="ognl:user.version != null">
<span jwcid="@Insert" value="ognl:user.username"/>
<input jwcid="@Hidden" type="hidden"
value="ognl:user.username" id="username"/>
</div>
</td>
</tr>
<component id="usernameField" type="ValidField">
<binding name="value" expression="user.username"/>
<binding name="validator" expression="beans.requiredValidator"/>
<message-binding name="displayName" key="user.username"/>
</component>
In Tapestry 4.0, I've translated to the following for the new DTD and
deprecated components:
<tr>
<th>
<label jwcid="@FieldLabel"
field="ognl:components.usernameField">Username</label>
</th>
<td style="height: 20px">
<div jwcid="@If" condition="ognl:user.version == null">
<input jwcid="usernameField" type="text" id="username"/>
</div>
<div jwcid="@Else" condition="ognl:user.version != null">
<span jwcid="@Insert" value="ognl:user.username"/>
<input jwcid="@Hidden" type="hidden"
value="ognl:user.username" id="username"/>
</div>
</td>
</tr>
<component id="usernameField" type="TextField">
<binding name="value" value="user.username"/>
<binding name="validators" value="validators:required"/>
<binding name="displayName" value="message:user.username"/>
</component>
However, when the field is hidden (the @Else logic executes), I get a
validation error:
You must enter a value for Username.
Is it possible to make the HTML in the @Else block have the same
componentId as usernameField?
Thanks,
Matt
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]