You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Stephane Delort <St...@edag.de> on 2004/07/16 11:38:10 UTC

cforms : show and hide widgets

Hello cocooners,


I have a form with selection lists, just as the car-selector sample.
I would like to display the list of "Type" to be displayed only once a
"Make" had been choosed.

I see two solution for this :
1 : could be cool if I could hide widgets in my flowscript withn something
like :
      var form = new Form("forms/my_form.xml");
      form.lookupWidget("makesList").setValue( 0);
     form.lookupwidget("typeList").hide();   // or // form.hideWidget
("typeList");
I saw on another issue that we could have problems with validating once the
form is submitted without all choices.

 2 : do 3 Pages
     1st :  only displaying the "MakeList" form;
     2nd : displaying "typeList" and "typeList";
     3rd : displaying the whole form;
     This solution is kinda ugly becaus I will have to make more then one
form template and form definition as well.

If any one got a proposal ...

thx in advance,
Stephane



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


Re: Dynamic CForms cases [was: cforms : show and hide widgets]

Posted by Robin Wyles <ro...@robinwyles.com>.
Joerg,

On 23 Jul 2004, at 08:50, Joerg Heinicke wrote:

> On 19.07.2004 10:30, Robin Wyles wrote:
>
>>> There is a union widget available in CForms. I already thought about 
>>> implementing the car selector sample via union widgets, but that's a 
>>> bit difficult as the cases are dynamic though not impossible:
>> Have you any ideas how one might go about making cases dynamic? I am 
>> currently trying to work this out myself...
>
> No, not really dynamic. You must know all cases and have one struct 
> for every case.

Ok, understood.

>
>> More specifically I would like to be able to dynamically build the 
>> contents of the <fd:struct> tags, and then use binding to 
>> pre-populate the widget values.
>
> It might work when generating the form definition on the fly. But 
> pre-populating fd:structs from a list of cases sounds like the already 
> existing Form Model GUI sample.

When I look it at the Form Model GUI sample (which I based my form on), 
I see that the default fd:structs are populated (through binding) but 
when you change the active fd:struct the newly displayed fields are not 
populated. This is the functionality I am after - a user selects an 
option from a drop down list and they are then presented with the 
appropriate fields (the fd:struct) with some of them pre-populated but  
still editable. Everything else is working, just not the 
pre-population, the binding for this needs to be different to the save 
binding, as the fields that the fd:structs need to contain are dynamic.

>
>>> <fd:class id="typeList-class">
>>>   <fd:widgets>
>>>     ... all the widgets ...
>>>   </fd:widgets>
>>> </fd:class>
>>>
>>> <fd:field id="makesList">
>>>   ... a field with the "Make" selection list ...
>>> </fd:field>
>>>
>>> <fd:union id="typeList-union" case="makesList">
>>>   <fd:widgets>
>>>     <fd:struct id="make1">
>>>       <fd:widgets>
>>>         <fd:new id="typeList-class"/>
>>>       </fd:widgets>
>>>     </fd:struct>
>>>     <fd:struct id="make2">
>>>       <fd:widgets>
>>>         <fd:new id="typeList-class"/>
>>>       </fd:widgets>
>>>     </fd:struct>
>>>     <fd:struct id="make3">
>>>       <fd:widgets>
>>>         <fd:new id="typeList-class"/>
>>>       </fd:widgets>
>>>     </fd:struct>
>>>     ...
>>>   </fd:widgets>
>>> </fd:union>
>>>
>>> As you can see you need one fd:struct for each case of the 
>>> makesList. There is already agreement that the union widget needs a 
>>> fd:case like in binding and template instead of the unconvenient 
>>> fd:struct like above. Also fd:case should allow "real" expressions 
>>> instead of pure string matching. But both is not implemented until 
>>> now.
>>>
>> I'm sorry but could you clarify this - do you know if  "real" 
>> expressions are supported in case matching yet?
>
> Ähm, I think this question I have already answered.

Yes, I see... thanks.

Robin

>
> Joerg
>
> ---------------------------------------------------------------------
> 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: Dynamic CForms cases [was: cforms : show and hide widgets]

Posted by Joerg Heinicke <jo...@gmx.de>.
On 19.07.2004 10:30, Robin Wyles wrote:

>> There is a union widget available in CForms. I already thought about 
>> implementing the car selector sample via union widgets, but that's a 
>> bit difficult as the cases are dynamic though not impossible:
> 
> 
> Have you any ideas how one might go about making cases dynamic? I am 
> currently trying to work this out myself...

No, not really dynamic. You must know all cases and have one struct for 
every case.

> More specifically I would 
> like to be able to dynamically build the contents of the <fd:struct> 
> tags, and then use binding to pre-populate the widget values.

It might work when generating the form definition on the fly. But 
pre-populating fd:structs from a list of cases sounds like the already 
existing Form Model GUI sample.

>> <fd:class id="typeList-class">
>>   <fd:widgets>
>>     ... all the widgets ...
>>   </fd:widgets>
>> </fd:class>
>>
>> <fd:field id="makesList">
>>   ... a field with the "Make" selection list ...
>> </fd:field>
>>
>> <fd:union id="typeList-union" case="makesList">
>>   <fd:widgets>
>>     <fd:struct id="make1">
>>       <fd:widgets>
>>         <fd:new id="typeList-class"/>
>>       </fd:widgets>
>>     </fd:struct>
>>     <fd:struct id="make2">
>>       <fd:widgets>
>>         <fd:new id="typeList-class"/>
>>       </fd:widgets>
>>     </fd:struct>
>>     <fd:struct id="make3">
>>       <fd:widgets>
>>         <fd:new id="typeList-class"/>
>>       </fd:widgets>
>>     </fd:struct>
>>     ...
>>   </fd:widgets>
>> </fd:union>
>>
>> As you can see you need one fd:struct for each case of the makesList. 
>> There is already agreement that the union widget needs a fd:case like 
>> in binding and template instead of the unconvenient fd:struct like 
>> above. Also fd:case should allow "real" expressions instead of pure 
>> string matching. But both is not implemented until now.
>>
> 
> I'm sorry but could you clarify this - do you know if  "real" 
> expressions are supported in case matching yet?

Ähm, I think this question I have already answered.

Joerg

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


Dynamic CForms cases [was: cforms : show and hide widgets]

Posted by Robin Wyles <ro...@robinwyles.com>.
Joerg,

On 19 Jul 2004, at 08:48, Joerg Heinicke wrote:

> On 16.07.2004 11:38, Stephane Delort wrote:
>
>> I have a form with selection lists, just as the car-selector sample.
>> I would like to display the list of "Type" to be displayed only once a
>> "Make" had been choosed.
>> I see two solution for this :
>> 1 : could be cool if I could hide widgets in my flowscript withn 
>> something
>> like :
>>       var form = new Form("forms/my_form.xml");
>>       form.lookupWidget("makesList").setValue( 0);
>>      form.lookupwidget("typeList").hide();   // or // form.hideWidget
>> ("typeList");
>> I saw on another issue that we could have problems with validating 
>> once the
>> form is submitted without all choices.
>>  2 : do 3 Pages
>>      1st :  only displaying the "MakeList" form;
>>      2nd : displaying "typeList" and "typeList";
>>      3rd : displaying the whole form;
>>      This solution is kinda ugly becaus I will have to make more then 
>> one
>> form template and form definition as well.
>> If any one got a proposal ...
>
> There is a union widget available in CForms. I already thought about 
> implementing the car selector sample via union widgets, but that's a 
> bit difficult as the cases are dynamic though not impossible:

Have you any ideas how one might go about making cases dynamic? I am 
currently trying to work this out myself... More specifically I would 
like to be able to dynamically build the contents of the <fd:struct> 
tags, and then use binding to pre-populate the widget values.

>
> <fd:class id="typeList-class">
>   <fd:widgets>
>     ... all the widgets ...
>   </fd:widgets>
> </fd:class>
>
> <fd:field id="makesList">
>   ... a field with the "Make" selection list ...
> </fd:field>
>
> <fd:union id="typeList-union" case="makesList">
>   <fd:widgets>
>     <fd:struct id="make1">
>       <fd:widgets>
>         <fd:new id="typeList-class"/>
>       </fd:widgets>
>     </fd:struct>
>     <fd:struct id="make2">
>       <fd:widgets>
>         <fd:new id="typeList-class"/>
>       </fd:widgets>
>     </fd:struct>
>     <fd:struct id="make3">
>       <fd:widgets>
>         <fd:new id="typeList-class"/>
>       </fd:widgets>
>     </fd:struct>
>     ...
>   </fd:widgets>
> </fd:union>
>
> As you can see you need one fd:struct for each case of the makesList. 
> There is already agreement that the union widget needs a fd:case like 
> in binding and template instead of the unconvenient fd:struct like 
> above. Also fd:case should allow "real" expressions instead of pure 
> string matching. But both is not implemented until now.
>

I'm sorry but could you clarify this - do you know if  "real" 
expressions are supported in case matching yet?

Thanks,

Robin


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


Re: cforms : show and hide widgets

Posted by Joerg Heinicke <jo...@gmx.de>.
On 16.07.2004 11:38, Stephane Delort wrote:

> I have a form with selection lists, just as the car-selector sample.
> I would like to display the list of "Type" to be displayed only once a
> "Make" had been choosed.
> 
> I see two solution for this :
> 1 : could be cool if I could hide widgets in my flowscript withn something
> like :
>       var form = new Form("forms/my_form.xml");
>       form.lookupWidget("makesList").setValue( 0);
>      form.lookupwidget("typeList").hide();   // or // form.hideWidget
> ("typeList");
> I saw on another issue that we could have problems with validating once the
> form is submitted without all choices.
> 
>  2 : do 3 Pages
>      1st :  only displaying the "MakeList" form;
>      2nd : displaying "typeList" and "typeList";
>      3rd : displaying the whole form;
>      This solution is kinda ugly becaus I will have to make more then one
> form template and form definition as well.
> 
> If any one got a proposal ...

There is a union widget available in CForms. I already thought about 
implementing the car selector sample via union widgets, but that's a bit 
difficult as the cases are dynamic though not impossible:

<fd:class id="typeList-class">
   <fd:widgets>
     ... all the widgets ...
   </fd:widgets>
</fd:class>

<fd:field id="makesList">
   ... a field with the "Make" selection list ...
</fd:field>

<fd:union id="typeList-union" case="makesList">
   <fd:widgets>
     <fd:struct id="make1">
       <fd:widgets>
         <fd:new id="typeList-class"/>
       </fd:widgets>
     </fd:struct>
     <fd:struct id="make2">
       <fd:widgets>
         <fd:new id="typeList-class"/>
       </fd:widgets>
     </fd:struct>
     <fd:struct id="make3">
       <fd:widgets>
         <fd:new id="typeList-class"/>
       </fd:widgets>
     </fd:struct>
     ...
   </fd:widgets>
</fd:union>

As you can see you need one fd:struct for each case of the makesList. 
There is already agreement that the union widget needs a fd:case like in 
binding and template instead of the unconvenient fd:struct like above. 
Also fd:case should allow "real" expressions instead of pure string 
matching. But both is not implemented until now.

Joerg


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