On the result page I only need the Label for the selected option. Not the entire list. The problem is that when you submit the form, you only submit the value in the form object and loose the label. I need to pass the label as well so that I do not have to requery for it.

The way that i have it currently is that the value contains a comma delemited string containing both the label and key (overkill on the bandwidth I know). In my action class, I do a string.split on the comma and pass the first value to my DAO processor and the Second value I put in my form for display. It is the only way I could think of without iterating through the options or storing the initial results which populate the option list.


Inactive hide details for "Frank W. Zammetti" <[EMAIL PROTECTED]>"Frank W. Zammetti" <[EMAIL PROTECTED]>


          "Frank W. Zammetti" <[EMAIL PROTECTED]>

          09/01/2005 11:28 AM

          Please respond to
          "Struts Users Mailing List" <user@struts.apache.org>

To

Struts Users Mailing List <user@struts.apache.org>

cc


Subject

Re: Select Options Question

I'm not sure I understand... do you just need to have the group name
when you display the detail for the selected item, or do you need the
entire select list (to avoid getting it from the datavase each time?)

If you just need the grou pname, could you simply put the group name in
session?  May or may not work depending on the flow of your app, but it
would be a nice, simple solution if it'll work... just remember to clear
it out at an appropriate time.

The other option that comes to mind immediately is indeed to use
_javascript_... seems like all you'd need is a form with two hidden
fields, groupName and value... onChange of the select, populate those
two fields and submit() the form.  You'd then have both pieces of
information to render your detail page.

Or maybe I don't understand the problem?

Frank

[EMAIL PROTECTED] wrote:
> I am sure there is a slick way to do this, but it escapes me at the moment.
>
> I have a Select Box that I am populating with the <html:options> tag  The
> result is:
>
> <select name="cmbGroup" id="groupList">
>     <option value="jk12341">Group 1</option>
>     <option value="34t1fv1">Group 2</option>
>     <option value="32fq21">Group 3</option>
>    ...
> </select>
>
> I need the value for DAO actions performed from the search which will
> return a detail bean for display on an output JSP.
>
> On the output JSP I need to Display the Group Name that I selected from the
> input.  My Form holds the group id and a field for the group name.  The
> options that I can see are:
>
> 1.  Requery the Database for the output page to retrieve the name given I
> have the key.  This would work, but seems like a lot of overhead to go to
> the database each time.
> 2.  Create a delimited value (ie <option value="jk12341, Group 1">Group
> 1</option>) and use the String Split to get the value and label.  (I am
> leaning toward this)
> 3.  use _javascript_ to update the field each time the select changes.  The
> problem with this is that the select box can be very large based on the
> users selections on previous entries.
> 4.  Store the Value Label list in the session (Don't like this at all
> because the volume of users that will use this application).
>
> Any other suggestions?
>

--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to