Do you perhaps have two forms on the page? You mentioned that onFormSubmission was returning false so is it possible that another form is doing the submit?

Also when you mention displaying errors, do you want the errors to be shown on top of the Form like one would get with a normal form? I don't think this will be possible because of the fly-weight pattern used. Only the last row's errors will be shown.

kind regards

bob

On 16/02/2010 02:56 AM, WarnerJan Veldhuis wrote:
Finally got some results, it's not correct yet, but something *is*
happening.

After all the processing is done, the method onSave is called, which is
an eventhandler for the submit button. That method always returned true,
which kills any error you got in your form, probably because of some
redirect mechanism? When I let it return false, the errors are shown.

More breaking news soon...




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



Reply via email to