cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christina" <lechael...@hotmail.com>
Subject Re: [CForm] how to setValue for a field of selection list?
Date Thu, 29 Jul 2004 18:41:01 GMT
Scott,
   I used the widget.setValue("selectedValue"), but what's shown in the form
is still the default value. this setValue works for other fields, but
obviously it doesn't work for fields with a selection list
   Thanks
Christina
----- Original Message -----
From: "Scott Yeadon" <scott.yeadon@anu.edu.au>
To: <users@cocoon.apache.org>
Sent: Wednesday, July 28, 2004 3:37 PM
Subject: Re: [CForm] how to setValue for a field of selection list?


> Christina,
>
> If you're saving the last selected value to a database and want to set
> the value to what the user selected last save, you need to be able to
> indicate which value was last selected, either via database field, XML
> attribute (if an XML database), or preferences file, or some other
> mechanism. If you know what was last selected you can then use the
> setValue call.
>
> Scott.
>
> Christina wrote:
>
> >No, I mean the selection list is already there.
> >What I want to do is to select a value from the list and show it on the
> >page, instead of the default value every time.
> >for example,
> >at first use select a value and save it. when he access this page again,
I
> >fetch the value from db and set the value to that droplist.
> >user can select another value if he want to change it.
> >
> >----- Original Message -----
> >From: "Stephane Delort" <Stephane.Delort@edag.de>
> >To: <users@cocoon.apache.org>
> >Sent: Wednesday, July 28, 2004 1:16 AM
> >Subject: Re: [CForm] how to setValue for a field of selection list?
> >
> >
> >
> >
> >>Hi Christina,
> >>
> >>maybe you should take a look  at the "setSelectionList" function.
> >>
> >>
> >>here is a sample of code I use to fill mine (as javascript in a cform
> >>template):
> >>
> >>var langWidget = event.source.lookupWidget("../lang");
> >>size = 10;
> >>for( var i=1; i &lt; size; i++) {
> >>     data.lang[i] = {value: languages.getValue(i), label:
> >>
> >>
> >languages.getLabel(i)};
> >
> >
> >>}
> >> langWidget.setSelectionList(data.lang, "value", "label");
> >>
> >>//languages is an home made java class
> >>
> >>
> >>hope this help,
> >>Stephane
> >>
> >>
> >>
> >>---------------------------------------------------------------------
> >>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
>
>

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


Mime
View raw message