You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Johannes Becker <jo...@gmx.net> on 2005/07/26 15:35:14 UTC
[CForms] - Design question
Hi,
I've got a couple of questions concerning CFoms.
I've got a form which holds two date and an integer field.
Either the two date fields or the integer field has to be filled out.
If the date fields are filled out, the first date has to be 'smaller or
equal' than the second date.
Question 1.:
How do achieve the: "Either the two date fields or the integer field has
to be filled out".
Question 2.:
How do achieve the: "The first date has to be 'smaller or equal' than
the second date".
Question 3.:
After success I want to call either function aaa (if dates were filled
in) or function bbb (if integer was filled in). How can I manage this?
My Forms-Definition so far:
<fd:widgets>
<fd:field id="date1">
<fd:datatype base="date">
<fd:convertor type="formatting">
<fd:patterns>
<fd:pattern>dd/MM/yyyy</fd:pattern>
</fd:patterns>
</fd:convertor>
</fd:datatype>
</fd:field>
<fd:field id="date2">
<fd:datatype base="date">
<fd:convertor type="formatting">
<fd:patterns>
<fd:pattern>dd/MM/yyyy</fd:pattern>
</fd:patterns>
</fd:convertor>
</fd:datatype>
</fd:field>
<fd:field id="integer">
<fd:datatype base="integer">
<fd:validation>
<fd:range min="0"/>
</fd:validation>
</fd:datatype>
</fd:field>
</fd:widgets>
Thanks
Jonny
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: [CForms] - Design question
Posted by Johannes Becker <jo...@gmx.net>.
Hi,
thank you all for your help. I'll look into these suggestions.
Cheers
Jonny
Christoph Hermann wrote:
>Johannes Becker schrieb:
>
>Hello,
>
>
>
>>I'm doing it in flowscript. But after success, how do I know which
>>fields (date or integer) were filled in?
>>
>>
>
>You simply check the value of one of the widgets?
>
>HTH
>Christoph
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: [CForms] - Design question
Posted by Christoph Hermann <ch...@tu-clausthal.de>.
Johannes Becker schrieb:
Hello,
> I'm doing it in flowscript. But after success, how do I know which
> fields (date or integer) were filled in?
You simply check the value of one of the widgets?
HTH
Christoph
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: [CForms] - Design question
Posted by Johannes Becker <jo...@gmx.net>.
Hi,
thanks for the quick response. I'll check your suggestions.
> For question3, i suggest you use CForms+flow, then it's easy to do
this in flowscript or if you don't like, javaflow.
I'm doing it in flowscript. But after success, how do I know which
fields (date or integer) were filled in?
Cheers
Jonny
Philippe Guillard wrote:
> Hi,
>
> For cross widgets validation, you just put a javascript section on top
> of you cform definition file. There you can access all these widgets
> and do comparison. I remember some of CForms samples do this.
> Otherwise i suggest to check the word validation in the mailing list
> archives.
> For question3, i suggest you use CForms+flow, then it's easy to do
> this in flowscript or if you don't like, javaflow.
>
> Phil
>
> Johannes Becker wrote:
>
>> Hi,
>>
>> I've got a couple of questions concerning CFoms.
>>
>> I've got a form which holds two date and an integer field.
>> Either the two date fields or the integer field has to be filled out.
>> If the date fields are filled out, the first date has to be 'smaller
>> or equal' than the second date.
>>
>> Question 1.:
>> How do achieve the: "Either the two date fields or the integer field
>> has to be filled out".
>>
>> Question 2.:
>> How do achieve the: "The first date has to be 'smaller or equal' than
>> the second date".
>>
>> Question 3.:
>> After success I want to call either function aaa (if dates were
>> filled in) or function bbb (if integer was filled in). How can I
>> manage this?
>>
>> My Forms-Definition so far:
>>
>> <fd:widgets>
>> <fd:field id="date1">
>> <fd:datatype base="date">
>> <fd:convertor type="formatting">
>> <fd:patterns>
>> <fd:pattern>dd/MM/yyyy</fd:pattern>
>> </fd:patterns>
>> </fd:convertor>
>> </fd:datatype>
>> </fd:field>
>> <fd:field id="date2">
>> <fd:datatype base="date">
>> <fd:convertor type="formatting">
>> <fd:patterns>
>> <fd:pattern>dd/MM/yyyy</fd:pattern>
>> </fd:patterns>
>> </fd:convertor>
>> </fd:datatype>
>> </fd:field>
>> <fd:field id="integer">
>> <fd:datatype base="integer">
>> <fd:validation>
>> <fd:range min="0"/>
>> </fd:validation>
>> </fd:datatype>
>> </fd:field> </fd:widgets>
>>
>> Thanks
>> Jonny
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: [CForms] - Design question
Posted by Philippe Guillard <pg...@citycita.net>.
Hi,
For cross widgets validation, you just put a javascript section on top
of you cform definition file. There you can access all these widgets and
do comparison. I remember some of CForms samples do this. Otherwise i
suggest to check the word validation in the mailing list archives.
For question3, i suggest you use CForms+flow, then it's easy to do this
in flowscript or if you don't like, javaflow.
Phil
Johannes Becker wrote:
> Hi,
>
> I've got a couple of questions concerning CFoms.
>
> I've got a form which holds two date and an integer field.
> Either the two date fields or the integer field has to be filled out.
> If the date fields are filled out, the first date has to be 'smaller
> or equal' than the second date.
>
> Question 1.:
> How do achieve the: "Either the two date fields or the integer field
> has to be filled out".
>
> Question 2.:
> How do achieve the: "The first date has to be 'smaller or equal' than
> the second date".
>
> Question 3.:
> After success I want to call either function aaa (if dates were filled
> in) or function bbb (if integer was filled in). How can I manage this?
>
> My Forms-Definition so far:
>
> <fd:widgets>
> <fd:field id="date1">
> <fd:datatype base="date">
> <fd:convertor type="formatting">
> <fd:patterns>
> <fd:pattern>dd/MM/yyyy</fd:pattern>
> </fd:patterns>
> </fd:convertor>
> </fd:datatype>
> </fd:field>
> <fd:field id="date2">
> <fd:datatype base="date">
> <fd:convertor type="formatting">
> <fd:patterns>
> <fd:pattern>dd/MM/yyyy</fd:pattern>
> </fd:patterns>
> </fd:convertor>
> </fd:datatype>
> </fd:field>
> <fd:field id="integer">
> <fd:datatype base="integer">
> <fd:validation>
> <fd:range min="0"/>
> </fd:validation>
> </fd:datatype>
> </fd:field> </fd:widgets>
>
> Thanks
> Jonny
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: [CForms] - Design question
Posted by Christoph Hermann <ch...@tu-clausthal.de>.
Johannes Becker schrieb:
Hello,
> I've got a form which holds two date and an integer field.
> Either the two date fields or the integer field has to be filled out.
> If the date fields are filled out, the first date has to be 'smaller or
> equal' than the second date.
>
> Question 1.:
> How do achieve the: "Either the two date fields or the integer field has
> to be filled out".
i'd use a combination of "empty()" and "and" and "or"
> Question 2.:
> How do achieve the: "The first date has to be 'smaller or equal' than
> the second date".
You have to use some additional validation (this should be possible
using the xreporter syntax).
See http://cocoon.apache.org/2.1/userdocs/forms/validation.html#Reference
and
http://cocoondev.org/xreporter/docs/core/91.html
> Question 3.:
> After success I want to call either function aaa (if dates were filled
> in) or function bbb (if integer was filled in). How can I manage this?
I would use flowscript for this.
HTH
Christoph
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org