i follow the following page -
http://tapestry.apache.org/tapestry4.1/components/form/select.html.
And now I can render the multi-elect item on the page with its index set to
0, 1, 2, 3 ...
However I want the index value to be string. For example, I have a color
list {"yellow", "green", "red"}, which will be displayed in the html but
with its option value set to, say, {"notice", "open", "stop"}.
or in html code as below:
<select name="colorList" multiple>
<option value="notice">yellow</option>
<option value="open">green</option>
<option value="stop">red</option>
</select>
I have tried to implement getCurrentColorIndex in the java code, but it
fails with "Unable to update OGNL expression ".
What should I do?
Thanks in advice.
Dan wrote:
>
> Hi,
>
> I am newbie to tapestry. I am having problems getting the selected values
> from a MULTIPLE select.
> From googling the net and reading the docs, the method i approached to get
> the selected value from a SINGLE select list(dropwdown) is by iterating
> over
> the collection being rendered and check if isSelected() is true.
>
> example:
>
> Page spec:
>
> <select jwcid="@Select">
>
> <option jwcid="@Option" selected="ognl:color.selected"
> label="ognl:color.name"/>
>
> </select>
>
> Java code:
>
> public Color getCurrentColor(){
> List l = getColorList();
> Color p;
> for (int i=0;i<l.size();i++){
> p = (Color)l.get(i);
> if (p.isSelected())
> return p;
> }
> return null;
> }
>
> I try to do similar thing with mulitple select, ie return a List of
> objects
> whose isSelected() == true. But this doesnt seem to work.
>
> Could someone please guide as to how do they retrieve the selected objects
> from the multiple select?
>
> Also are there any contrib:palette examples out there? The book
> doesnt...neither did googling help.
>
> Thanks a bunch!
>
> _________________________________________________________________
> Don?t just search. Find. Check out the new MSN Search!
> http://search.msn.click-url.com/go/onm00200636ave/direct/01/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/Multiple-Select-tf144431.html#a13976675
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]