On Tuesday 06 September 2005 02:18 am, Angelo Immediata wrote:
> Hi. First of all thanks for your reply.
>
> I have a web service that returns a org.w3c.dom.Document this Document
> follows a XML schema; i use JAXB for unmarshalling it and then i use the
> Java Objects in order to build the selction list. I use a code like this:
>
> if(lenListDatiOutput>1 || lenListDatiOutput==0){
> Lis.add({"name" : "", "label" : "Seleziona il comune"})}
> for (var i=0; i<lenListDatiOutput; i++){
> datiOutput = (DatiOutput)(listDatiOutput.get(i));
> if (datiOutput!=null){
> var codice= datiOutput.getCodiceIstatComune();
> var descr = datiOutput.getDescrizioneComune();
> Lis.add({ "name" : codice , "label": descr });
>
> }//if (datiOutput!=null){
> }//for (var i=0; i<lenListDatiOutput; i++){
> }//if (esito!=null){
> form.lookupWidget(campo).setSelectionList(Lis, "name", "label");
OK, so you're using the FlowJXPathSelectionList. The bad news is that this
particular SelectionList implementation does not seem to provide any public
methods for iterating over its items. But the good news is that since your
list of selection-list items is being built in your flowscript, you should be
able to fairly easily access it from flowscript that follows. You just have
to figure out how to get the "Lis" variable passed along to wherever you need
it. If it's within the same flow function then Lis should be available
directly. If it's in another function you can possibly pass it along as an
argument to that second function. Another possible way is to attach "Lis" as
an attribute to the field widget and access it later, like:
form.lookupWidget(campo).setAttribute("selectionListItems", Lis);
...
form.lookupWidget(campo).getAttribute("selectionListItems");
Then you can iterate over the items in Lis (I'm not sure what type of object
that is so I'll leave the details to you) to find the one with your target
value and get its label.
I hope this helps.
--Jason
>
>
> ---------- Initial Header -----------
>
> From : "Jason Johnston" [EMAIL PROTECTED]
> To : [email protected]
> Cc :
> Date : Mon, 5 Sep 2005 13:51:16 -0600
> Subject : Re: CForm: get the description label from selection list
>
> > On Monday 05 September 2005 11:10 am, Angelo Immediata wrote:
> > > I have this problem... i have a combobox; its values are obtained by
> > > invocking a web service. Now i need to show in an another page the
> > > description label of the element choosen by the user... how can i
> > > obtain it?
> > >
> > > [snip]
> > >
> > > Now if the user chooses the value "SAN GALLO" i'll have the code
> > > "000244"... well in the next page i'ld like to show the value "SAN
> > > GALLO" and not the code.. how can i recover this string without
> > > invocking the web service?Is it possible? Thanks to all.
> >
> > How exactly is the selection-list being built from the web service? It
> > should be possible to do what you want, but the approach will depend on
> > how you're getting the selection-list in the first place.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
> ____________________________________________________________
> 6X velocizzare la tua navigazione a 56k? 6X Web Accelerator di Libero!
> Scaricalo su INTERNET GRATIS 6X http://www.libero.it
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]