cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <joerg.heini...@gmx.de>
Subject Re: "optional required" widget (was Re: [cforms] Clear validation error on a widget?)
Date Thu, 15 Apr 2004 05:26:47 GMT
On 15.04.2004 05:29, Mark Lundquist wrote:

> I don't think it's related.  My problem has nothing to do with 
> <fd:action>.  I have:
> 
> • a submit widget;
> • a repeater containing a text widget and a booleanfield
> • an <fd:validate/javascript> snippet in the repeater definition; this 
> does the only validation in my form
> 
> Once the validation script has posted a validation error, then, the next 
> time I submit, the validation script fires only if I have changed the 
> text widget.  If I only change the checkbox, then the validation script 
> does not fire!  This breaks my form, because the validation script is 
> supposed to clear the validation error on the text widget if the 
> checkbox is checked.

Ok, tested it myself by setting form1 sample/ repeater[@id="contacts"]/ 
field[@id="firstname"]/ @required="true".

Steps:
- add 3 rows
- submit
- select the first of these 3 rows
- change the firstname value of the 2nd of these 3 rows
- and hit "remove selected contacts"

Result:
- Field "firstname" from old row 2 of these 3 rows has no validation 
errors though it was not validated, only the validation errors have been 
cleared. Also read below.
- Field "firstname" from old row 3 of these 3 rows has still validation 
error.

> ----
> BTW, while I believe it's unrelated, you mentioned the <fd:action> 
> behavior in flow vs. form actions as shown in the form1 sample.  What 
> I'm seeing there (fresh CVS HEAD) is:
> 
> • In the action version, activating an action widget clears previous 
> validation errors and does not cause anything to be revalidated;
> 
> • In the flow version, I see the following behavior (understand this as 
> an "as if" description): validation seems to be triggered when the 
> action widget is activated; previous validation errors are cleared for 
> widgets that now validate successfully, but no new validation errors are 
> posted.

I had a look again: no validation happens on fd:action, only the 
validation errors are cleared if and only if the value has changed. 
Tried it again with form1: invalid date, submit, changed date to another 
invalid date, action 'add contact': no validation error is shown.

>  From what I remember of the implementation, I don't really understand 
> why the flow version would behave as it does, but IMHO that is exactly 
> the correct behavior!  The action version seems slightly broken — it 
> shouldn't clear validation errors like it does.

IMO the action version is at least consistent while the flow version is not.

> But anyway, as I said I don't think this has anything to do with my 
> repeater validation problem...

I think it is. Action shall not trigger validation and it does not. The 
fields only clear their validation errors "on value changed" while 
boolean value does not.

Joerg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message