On Apr 14, 2004, at 10:26 PM, Joerg Heinicke wrote:
Ok, tested it myself by setting form1 sample/ [EMAIL PROTECTED]"contacts"]/ [EMAIL PROTECTED]"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.
Right. And also, I now see in the code why that happens (see below)...
----
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.
Exactly.
IMO the action version is at least consistent while the flow version is not.
How is it inconsistent? However I would maybe retract my opinion that the behavior we're seeing in the flow version is "correct" (but not because of the problem I'm having, just in general). I think correct behavior for action widgets would be to not clear any validation errors, WDYT?
Also... why is the action version different from the flow version? Unquestionably it is different, but I don't understand why it should be.
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.
Well, I now understand exactly my problem with implementing the "optional required" use case in the <repeater/validate/javascript>. My validation script doesn't run because that's just the semantics of repeater validation... here is Repeater.validate():
public boolean validate(FormContext formContext) {
boolean valid = true;
Iterator rowIt = rows.iterator();
while (rowIt.hasNext()) {
RepeaterRow row = (RepeaterRow)rowIt.next();
valid = valid & row.validate(formContext);
}
return valid ? super.validate(formContext) : false;
}Just to make sure I understood correctly, I hacked Field.readFromRequest() as follows:
if (!(newEnteredValue == null ? "" : newEnteredValue).equals((enteredValue == null ? "" : enteredValue))) {
getForm().addWidgetEvent(new DeferredValueChangedEvent(this, value));
enteredValue = newEnteredValue;
}
validationError = null;
value = null;
needsParse = true;
i.e., made 'validationError = null;' etc. unconditional. That made my problem "go away".
So now I understand what is happening, but I have no idea how to fix it or how to work around it.
In your implementation of the "optional required" use case, are you using flow or actions?
~ mark
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
