You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Olivier Billard <ob...@rennes.jouve.fr> on 2004/01/07 18:38:09 UTC

Re: How to validate (range, min, max) a field depending on another (boolean) field value ? Was: [cforms] Optionally required fields

Thanks for your answer Sylvain,

A boolean condition on the assert validator instead of a range validator suits me well, 
but to play the devil's advocate ;), what about more complex validations, such email ? No 
way for the moment ?
It would be very interesting !

--
Olivier

PS : also about woody, I had another question about validation on users' ;) :
http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=107340459803769&w=2


On 07/01/2004 18:26, Sylvain Wallez wrote:

> Olivier Billard wrote:
> 
>> Hi all, Hi Sylvain,
> 
> Hi Olivier!
> 
>> Your post makes me wonder if it is possible to do validation of a 
>> field (any type of validation) depending of another field value, or 
>> "conditionize" the requirement of a field depending on another field 
>> value :
>>
>> Exemple :
>>  - boolean field "recall" : true/false
>>  - field "number of recalls" : required if recall is true and ranges 
>> from 1 to n
>>
>> is it possible to do so ?
> 
> 
> 
> What about using the "assert" validator? Of course, you'll have to write 
> a boolean condition rather than just using the attributes provided by 
> the "range" validator.
> 
>> For the moment,I set "number of recalls" field required with a default 
>> value of 1, but display the field only if recall is true (hidden 
>> otherwise)... and deal with its requirement later in business code... 
>> but if woody could do this, it would be cool.
> 
> 
> 
> Well, seems it already does it ;-)
> 
> Sylvain



Re: How to validate (range, min, max) a field depending on another (boolean) field value ? Was: [cforms] Optionally required fields

Posted by Vadim Gritsenko <va...@reverycodes.com>.
Sylvain Wallez wrote:

> Olivier Billard wrote:
>
>> Thanks for your answer Sylvain,
>>
>> A boolean condition on the assert validator instead of a range 
>> validator suits me well, but to play the devil's advocate ;), what 
>> about more complex validations, such email ? No way for the moment ?
>> It would be very interesting !
>
>
>
> <mode type="random-thoughts">
>  What about nested validators? Child validators would be checked only 
> if the parent succeds.


Good idea.

> </mode>


(is it FS? ;-)

Vadim



Re: How to validate (range, min, max) a field depending on another (boolean) field value ? Was: [cforms] Optionally required fields

Posted by Antonio Gallardo <ag...@agsoftware.dnsalias.com>.
Sylvain Wallez dijo:
> Olivier Billard wrote:
>
>> Thanks for your answer Sylvain,
>>
>> A boolean condition on the assert validator instead of a range
>> validator suits me well, but to play the devil's advocate ;), what
>> about more complex validations, such email ? No way for the moment ?
>> It would be very interesting !
>
>
> <mode type="random-thoughts">
>   What about nested validators? Child validators would be checked only
> if the parent succeds.
> </mode>

<xsl:parse-mode type="random-thoughts"> :-D
  Nested validator sounds good to me. In some models "nested" validators
means: "logic AND", while no nested means logical OR.
</mode>

WDYT?

Best Regards,

Antonio Gallardo

Re: How to validate (range, min, max) a field depending on another (boolean) field value ? Was: [cforms] Optionally required fields

Posted by Sylvain Wallez <sy...@apache.org>.
Olivier Billard wrote:

> Thanks for your answer Sylvain,
>
> A boolean condition on the assert validator instead of a range 
> validator suits me well, but to play the devil's advocate ;), what 
> about more complex validations, such email ? No way for the moment ?
> It would be very interesting !


<mode type="random-thoughts">
  What about nested validators? Child validators would be checked only 
if the parent succeds.
</mode>

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -  http://www.orixo.com