You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Dan Ochs <da...@gmail.com> on 2005/07/05 21:57:27 UTC
how to add a Select All to a cform fd:multivaluefield element?
Hi, 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'm assuming I can
figure out how to create a select all/none link, but I'm not sure how
I would hook it into the multivaluefield element. The field
definition code I have so far is below, the on-value-changed is not
working as far as I can see...
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>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: how to add a Select All to a cocoon forms table?
Posted by Dan Ochs <da...@gmail.com>.
ahhh, yes I was confused and now have it working!
thanks!
dan
On 7/7/05, Reinhard Poetz <re...@apache.org> wrote:
> 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}
>
> web(log): http://www.poetz.cc
> --------------------------------------------------------------------
>
Re: how to add a Select All to a cocoon forms table?
Posted by Reinhard Poetz <re...@apache.org>.
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}
web(log): http://www.poetz.cc
--------------------------------------------------------------------
how to add a Select All to a cocoon forms table?
Posted by Dan Ochs <da...@gmail.com>.
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>
Re: how to add a Select All to a cform fd:multivaluefield element?
Posted by Mark Lundquist <ml...@comcast.net>.
Hi Dan,
On 2005-07-05 12:57:27 -0700, Dan Ochs <da...@gmail.com> said:
> Hi, 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?
>
> Hmmm, what does "on-value-changed" have to do with adding a "select
> all/none link"?
I'm assuming I can
> figure out how to create a select all/none link, but I'm not sure how
> I would hook it into the multivaluefield element. The field
> definition code I have so far is below, the on-value-changed is not
> working as far as I can see...
>
> 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>
>
> alert()!?!? <fd:on-value-changed> is a server-side thing! :-)
Anyway... for your select all / clear all feature, I would do it
client-side. Both for performance reasons, and also... form controls
that only affect other controls IMHO don't belong in the CForms form
definition. It's hard to explain why — I'm having a Bad Brain Day here
— but... they just don't! :-) The CForms Form should have only stuff
that the biz model cares about, or that the controller needs (e.g.
<submit> and <action>). Can you dig on that? I hope so 'cause I can't
explain it any better right now... :-/
Cheers,
—ml—
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org