I've got a feeling that we're heading for a PICNIC here. Hold your
research, don't start rewriting Click yet ;)
On 02/15/2010 04:00 PM, WarnerJan Veldhuis wrote:
I think I got a little further on this problem: it appears that
form.isFormSubmission() on line 234 of FieldColumn always returns
false. I've put some debugging code in front of it:
"RSV=" + formTable.getRenderSubmittedValues() + ", isClicked=" +
formTable.getControlLink().isClicked() + ", isFormSub=" +
form.isFormSubmission()
RSV=true, isClicked=false, isFormSub=false
RSV=true, isClicked=false, isFormSub=false
RSV=true, isClicked=false, isFormSub=false
RSV=true, isClicked=false, isFormSub=false
RSV=true, isClicked=false, isFormSub=false
RSV=true, isClicked=false, isFormSub=false
...loads more...
Why would isFormSubmission be false?
On 02/15/2010 03:14 PM, Bob Schellink wrote:
FormTable can be tricky.
The thing to remember is that FormTable uses the flyweight pattern
for the columns. Thus only a single Field is created per column and
reused in each row.
The tricky bit is FieldColumn#renderTableDataContent. This method is
called for each row in the table. You'll note that this method
appends the row index to the field name before it is processed.
What I think happens is:
- row 1 is processed setting field name to "field_0"
- field is processed which sets its value to the request parameter
"field_0"
- validation fails and the error is set on the field's title attribute
- row 2 is processed setting *the same* field name to "field_1"
- the field is processing setting its value to the request parameter
"field_1"
- validation succeeds and the error message is set to null
If this doesn't help do you have a small example I can look at?
kind regards
bob
On 16/02/2010 12:49 AM, WarnerJan Veldhuis wrote:
I am having trouble with the FormTable, FieldColumn and the validation
for the fields.
The FormTable.onProcess() calls Field.onProcess(), which in turn calls
Field.validate(). I can see the error being present all the time after
it has been set. But as soon as Field.onProcess() ends (The return
value
is ignored btw), FormTable continues by calling Field.isValid(). That
method checks for Field.error == null. And to my big surprise the value
is indeed null, while seconds ago I have seen a message get set on the
error-member.
So I am quite puzzled here. Why does FormTable not validate like it
should?
Cheers,
WarnerJan