Sorry Timo,

your example seems fine at first glance. But what should the textfield do when the condition switches to false and it had text? If it switches to true with bound text?

And what should the user think if she puts in some value to that field as it is visible and then you just ignore it on submit?

The error ist yours. It is a bug to deliver something in appendToResponse and not having it anymore in takeValuesFromRequest, or vice versa. Never change a condition in takeValuesFromRequest. It leads to odd behavior of most WOClasses, as they can not know what you intended.

        atze


Am 22.02.2008 um 10:14 schrieb Timo Hoepfner:

Hi,

I've stumbled across a behaviour of WOTextField (and possibly other WOInput subclasses) which looks like a bug to me:

When you have a textfield within a form, that appears as a result of the submission of that form (e.g. because it's in a conditional, whose condition becomes true as a result of the form submission), it will set it's binding to null during takeValuesFromRequest, as it's name doesn't appear in the WORequest's formValueKeys, which is (mis-)interpreded as "value is null". IMHO, the WOTextField should only set the binding, if it's name appears in the formValueKeys.
Is this a bug or intended behaviour?
I'm not sure, why this doesn't happen, when e.g. using a WOCollapsibleComponentContent with submitActionName bound. Probably I have to re-read "The secret life of components" chapter...

Below is some code to reproduce the problem and a workaround.

Timo



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to