Hi, I have just spent a fair few hours trying to track down a problem in T4, and I wanted to describe it here in case it catches anyone else out. I don't think this is a bug, just something to watch out for.
Here is the setup. I have a preexisting object in the session which is displayed in a form for editing. I am not doing any validation in tapestry because we have a separate validation framework and we collect errors that way, feeding them back into the tapestry system for display. HOWEVER, in a previous dev cycle, I had set some validators in the .page descriptor for some of the fields, and these were still there. I had not, however, enabled client validation, nor was I checking for these errors in the page class. When I changed the values of the fields, no problem. They were updated. But when I wanted to set a field to null (which should have triggered an error in our external validator), there was no error, and the old value was not being overwritten. After trying all sorts of stuff for hours, I finally set a debug point on the TextField rewindFormComponent method. The empty value was being passed to the rewind as it should have been. However, getValidatableFieldSupport().validate(this, writer, cycle, object) was then being called, and, of course, failing, resulting in an exception and the bypassing of setValue() (this is the bit I wasn't expecting). Because I had not enabled client side validation, I was completely unaware of this problem - the object was simply saved with the old values. Logically, of course, this is exactly what the validators should do, but if you forget you have defined them for a field, you can waste a lot of time wondering why your values are not getting saved. So the moral is: if you define validators for a field, they will block the setting of invalid values whether you are tracking validation errors or not :>) Best wishes John --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
