cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vadim Gritsenko <va...@reverycodes.com>
Subject Re: CForms: on-action handling
Date Sun, 01 Oct 2006 11:29:27 GMT
Sylvain Wallez wrote:
> Simone Gianni wrote:
>> I can't remember, but without validating before executing it's
>> possible to make buttons like "Fill with default values" or "Use the
>> same address for delivery" which could not be possible if the form
>> gets validated before performing the action.

How validation would prohibit changing the form data?


>> Wasn't there a
>> validate="true|false" attribute on actions?
> 
> Yup, you're right. Actions can change the contents of the form, and thus
> validation occurs after actions are run.

And after that form is displayed again, and will get re-validated on next user 
action, so it does not seem like a show stopper.

The only scenario I can think of which might cause a problem: If above mentioned 
delivery address is mandatory, it would be marked as invalid before action fills 
it in. But after action sets its value, validation error will be cleared anyway.


> As for the validate="true|false", it is meant to allow actions that
> should exit form.show() without even trying to validate. This for
> actions such as "cancel".

Nope, "validate" flag is defined only on submit widgets currently, not on actions.

Now, it is possible to define it on action widgets as well (in case if current 
"pre-validate" actions are deemed necessary).

Vadim


>> Vadim Gritsenko wrote:
>>> Hi All,
>>>
>>> Just recently noticed that on-action events are fired before form is
>>> validated :)
>>>
>>> Can anybody recall the reason why this was done? Any reason why not
>>> do it after validation? Since most of the time actions will
>>> manipulate forms content, it makes sense to validate complete form
>>> first, or so it seems. WDYT?


Mime
View raw message