You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Timothy Larson <ti...@yahoo.com> on 2003/08/21 19:05:36 UTC

Woody - required vs validation

I noticed in the Woody form1 sample that the drinks are
not marked required="true", but they act like they are
required because of their validation rule:
  <wd:validation>
    <wd:value-count exact="2"/>
  </wd:validation>
It seems that if the field is not required and no drinks
are selected, then this validation rule should not be
enforced.

I am wondering what meaning we want to attach to the
required attribute.  Comments anybody?

--Tim Larson


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

Re: Woody - required vs validation

Posted by Timothy Larson <ti...@yahoo.com>.
--- Antonio Gallardo <ag...@agsoftware.dnsalias.com> wrote:
...
> I think you are right the correct approach is:
> 
> A-required="true"  - field cannot be empty (NULL) and must be validated.
> B-required="false" - if (field is not empty) then validate.

Yes, clearly stated.  I thought about this some more and have another issue.
When using multi-field validation, the value in another field may determine
whether or not a field is required.  For this case A should be relaxed to:
  A-required="true"  - field may or may not be empty and must be validated.
Alternately, we could leave A as you stated and add this as a third case:
  C-required="maybe" - field may or may not be empty and must be validated.

If the validation logic is duplicated on the client with javascript, then
the visual indicator of whether a field is required could be dynamically
updated when the fields it depends on are changed.  This could also be
achieved with server-side logic, but would not be quite as dynamic as it
could only update the indicator on posts.

--Tim Larson


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

Re: Woody - required vs validation

Posted by Antonio Gallardo <ag...@agsoftware.dnsalias.com>.
Timothy Larson dijo:
> I noticed in the Woody form1 sample that the drinks are
> not marked required="true", but they act like they are
> required because of their validation rule:
>   <wd:validation>
>     <wd:value-count exact="2"/>
>   </wd:validation>
> It seems that if the field is not required and no drinks
> are selected, then this validation rule should not be
> enforced.
>
> I am wondering what meaning we want to attach to the
> required attribute.  Comments anybody?

I think you are right the correct approach is:

A-required="true"  - field cannot be empty (NULL) and must be validated.
B-required="false" - if (field is not empty) then validate.

Best Regards,

Antonio Gallardo