You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Bhaarat Sharma <bh...@gmail.com> on 2009/07/28 03:52:30 UTC
getting listValue back to actionclass from s:select tag
I have a s:select tag which is working fine.
<s:select label="fmr.terminationReason"
name="fmr.terminationReason"
list="rejectionReasons"
listKey="rejectedReasonCode"
listValue="rejectedReason"
multiple="true"
required="true"
size="9"
value="%{fmr.terminationReason.{reasonId}}"/>
html code made out of that is:
<select name="fmr.terminationReason" size="9" multiple="multiple">
<option value="1">Reason1*</option>
<option value="2">Reason2</option>
<option value="3">Reason3*</option>
</select>
when user selects stuff from this select box and submits what is sent back
is listKey. Is there any way to get the listValue (content) back to the
action class?
I want to do this because as you can see some reasons have * behind them and
I want to have some logic for when users select reasons with *. I can not
just go by value because it is dynamic.
Is there a way to get around this hurdle?
Re: getting listValue back to actionclass from s:select tag
Posted by mu...@aol.com.
Not sure what you mean when you say it is dynamic -- Why not keep track of the original key-value pairs in the user session?
You only need the key.
Chris
-----Original Message-----
From: Bhaarat Sharma <bh...@gmail.com>
To: Struts Users Mailing List <us...@struts.apache.org>
Sent: Mon, Jul 27, 2009 9:52 pm
Subject: getting listValue back to actionclass from s:select tag
I have a s:select tag which is working fine.
<s:select label="fmr.terminationReason"
name="fmr.terminationReason"
list="rejectionReasons"
listKey="rejectedReasonCode"
listValue="rejectedReason"
multiple="true"
required="true"
size="9"
value="%{fmr.terminationReason.{reasonId}}"/>
html code made out of that is:
<select name="fmr.terminationReason" size="9" multiple="multiple">
<option value="1">Reason1*</option>
<option value="2">Reason2</option>
<option value="3">Reason3*</option>
</select>
when user selects stuff from this select box and submits what is sent back
is listKey. Is there any way to get the listValue (content) back to the
action class?
I want to do this because as you can see some reasons have * behind them and
I want to have some logic for when users select reasons with *. I can not
just go by value because it is dynamic.
Is there a way to get around this hurdle?
RE: getting listValue back to actionclass from s:select tag
Posted by Lee Clemens <ja...@leeclemens.net>.
I believe the Label is rather meaningless (from a data point-of-view).
Do you know which options have a * after them when you create the drop down?
So you would know that key=1 has a *, key=2 does not, etc?
Not sure I understand the reason for the label in this scenario, since the
key is - the key.
But afaik, the key is submitted (as would be during any other HTML form's
submission) - not the label.
-----Original Message-----
From: Bhaarat Sharma [mailto:bhaarat.s@gmail.com]
Sent: Monday, July 27, 2009 9:53 PM
To: Struts Users Mailing List
Subject: getting listValue back to actionclass from s:select tag
I have a s:select tag which is working fine.
<s:select label="fmr.terminationReason"
name="fmr.terminationReason"
list="rejectionReasons"
listKey="rejectedReasonCode"
listValue="rejectedReason"
multiple="true"
required="true"
size="9"
value="%{fmr.terminationReason.{reasonId}}"/>
html code made out of that is:
<select name="fmr.terminationReason" size="9" multiple="multiple">
<option value="1">Reason1*</option>
<option value="2">Reason2</option>
<option value="3">Reason3*</option>
</select>
when user selects stuff from this select box and submits what is sent back
is listKey. Is there any way to get the listValue (content) back to the
action class?
I want to do this because as you can see some reasons have * behind them and
I want to have some logic for when users select reasons with *. I can not
just go by value because it is dynamic.
Is there a way to get around this hurdle?
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org