cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reinhard Poetz <>
Subject Re: how to add a Select All to a cocoon forms table?
Date Thu, 07 Jul 2005 14:49:41 GMT
Dan Ochs wrote:
> Hi everyone, I sent this to the users list first and got no reply, so
> I'm trying here.  I am new to cocoon forms and am trying to figure out
> the best way
> to add a select all/none link into a multivaluefield element.  So far
> I have tried to detect the checkbox click with a fd:on-value-changed
> element in the fd:field element, but that doesn't seem to be working.
> Does anyone know the best way to implement this?  I have it working if
> I just put the link and javascript directly in the form template since
> I know how the form elements will be named, but I'm assuming there is
> a better or more proper way to do this.  The field definition code I
> have so far is below, the on-value-changed is not
> working as far as I can see...
> Another way I can ask these same concepts more generically is:
> In the cocoon forms examples, the Various (Actions) example, how would
> a Select None/All link be added to the table column with the title of
> Select.  (and as a separate question, how would I get the row
> background colors to alternate?)
> any help is appreciated!
> thanks, dan
> <fd:multivaluefield id="myTypes">
>         <fd:label/>
>         <fd:datatype base="string"/>
>         <fd:validation>
>                 <fd:value-count min="1"/>
>         </fd:validation>
>         <fd:on-value-changed>alert('gothere');</fd:on-value-changed>
>         <fd:selection-list>
>                 <fd:item value="value1">
>                         <fd:label>Label 1</fd:label>
>                 </fd:item>
>                 <fd:item value="value2">
>                         <fd:label>Label 2</fd:label>
>                 </fd:item>
>                 <fd:item value="value3">
>                         <fd:label>Label 3</fd:label>
>                 </fd:item>
>         </fd:selection-list>
> </fd:multivaluefield>

first, as you write "alert('')" I guess that you misunderstood how event 
handling works in Cocoon. <fd:on-value-changed> triggers *server side* events 
and is *not* executed at the client.

to your question: I would add a <fd:action> widget and add the event within 
<fd:on-action>. There you have access to the other widgets and you can set the 
values in your "myTypes". Have a look at the samples for concrete code.

Reinhard Pötz           Independent Consultant, Trainer & (IT)-Coach 

{Software Engineering, Open Source, Web Applications, Apache Cocoon}


View raw message