cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Gianni <s.gia...@thebug.it>
Subject Re: Null values with fd:assert
Date Tue, 09 May 2006 16:51:40 GMT
Hi Daniel,
something like this should do the trick :

      <fd:assert test="And(Not(IsNull(startdate)), enddate &gt;
startdate)">

Or something similar. These are currently daisy expressions, you can
read more about them here :
http://cocoondev.org/xreporter/docs/core/exprlang.html . IsNull is an
expression added to the xreporter language by cocoon forms to do exactly
this kind of tricks.

Hope this helps,
Simone


Daniel Curran wrote:

> I have two dates defined as:
>
> <fd:field id="startdate">
>    <fd:label>Start Date</fd:label>
>    <fd:datatype base="date">
>       <fd:convertor type="formatting">
>          <fd:patterns>
>             <fd:pattern>MM/dd/yyyy</fd:pattern>
>          </fd:patterns>
>       </fd:convertor>
>    </fd:datatype>
> </fd:field>
>
> <fd:field id="enddate">
>    <fd:label>End Date</fd:label>
>    <fd:datatype base="date">
>       <fd:convertor type="formatting">
>          <fd:patterns>
>             <fd:pattern>MM/dd/yyyy</fd:pattern>
>          </fd:patterns>
>       </fd:convertor>
>    </fd:datatype>
>    <fd:validation>
>       <fd:assert test="enddate &gt; startdate">
>          <fd:failmessage>End date must be greater than the Start
> date</fd:failmessage>
>       </fd:assert>
>    </fd:validation>
> </fd:field>
>
> When I set an end date, but leave the start date null I get an error
> _Error evaluating expression on assert validation rule._
>
> I would like the test to pass if either or both fields values are null.
>
> Does anyone know how this would be accomplished? I am also interested
> in documentation of the types of rules that can be used, where should
> I look for this?
>
> Thanks,
> Dan Curran
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
-- 
Simone Gianni

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


Mime
View raw message