You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Christian Mittendorf <ch...@freenet.de> on 2006/01/31 18:15:13 UTC

Forms, PropertySelection and Delegate - a bug?

Hello!

I've got a question regarding the fieldTrackings of a form delegate.

 From my understanding, this is a list of trackings that the delegate  
stores. It does contain a tracking entry for each form field that is  
being validated. A field tracking may contain the error message  
(errorRenderer != null), but it would also be present if the related  
form field does validate without any errors. So you can step through  
the trackings and display the message next to the input field.

In my example below, submitting the empty form creates field tracking  
list with an error for each field, which  is the expected behaviour.

But if I enter values into all fields of the form, the field  
trackings contains only entries for TextField and DatePicker. There  
are no recordings for the PropertySelection and the Checkbox field,  
thus you cannot step through the trackings list and display the error  
message.

Is this a bug or is this the way it should work?

Christian

P.S. I'm using Tapestry 4.0.


My Example Test.html:

<html>
<head>
<title>Test</title>
</head>
<body jwcid="@Body">

<table border="1">
<tr>
<td><b>fieldName</b></td>
<td><b>component</b></td>
<td><b>input</b></td>
<td><b>errorRenderer</b></td>
</tr>
<span jwcid="@For" source="ognl:beans.delegate.fieldTracking"  
value="ognl:tracking">
<tr>
<td><span jwcid="@Insert" value="ognl:tracking.fieldName"/></td>
<td><span jwcid="@Insert" value="ognl:tracking.component"/></td>
<td><span jwcid="@Insert" value="ognl:tracking.input"/></td>
<td><span jwcid="@Insert" value="ognl:tracking.errorRenderer"/></td>
</tr>
</span>
</table>

<form jwcid="@Form" delegate="ognl:beans.delegate">
<input type="text" jwcid="@PropertySelection" value="ognl:anrede"  
validators="validators:required"  
model="ognl:@de.foo.BeanTypeDefinitions@SALUTATIONMODEL"/><br/>
<input type="text" jwcid="@TextField" value="ognl:name"  
validators="validators:required"/><br/>
<input type="text" jwcid="@DatePicker" value="ognl:date"  
validators="validators:required"/><br/>
<input type="text" jwcid="@Checkbox" value="ognl:check"  
validators="validators:required"/><br/>
<input type="submit"/>
</form>

</body>
</html>

witch SALUTATIONMODEL defined as:

public static final IPropertySelectionModel SALUTATIONMODEL = new  
LabeledPropertySelectionModel(new StringPropertySelectionModel(new  
String[] {"Frau", "Herr"}), "Bitte wählen ");

and Test.page as:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page-specification PUBLIC
   "-//Apache Software Foundation//Tapestry Specification 4.0//EN"
   "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
<page-specification class="org.apache.tapestry.html.BasePage">
     <bean name="delegate"  
class="org.apache.tapestry.valid.ValidationDelegate"/>	
     <property name="tracking"/>
     <property name="anrede"/>
     <property name="name"/>
     <property name="date"/>
     <property name="check"/>
</page-specification>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org