Re: Select Options Question

2005-09-01 Thread netsql
Chapter 16 in wiki struts book will tell you how to use options 
collections w/ DAO, and it has a lab.

hth,
.V

[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=jk12341Group 1/option
option value=34t1fv1Group 2/option
option value=32fq21Group 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 1Group
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?




--
thx,
.V

Broadband interface (RIA) + mail box safety = Roomity.com
http://roomity.com/demo.jsp
*Your* clubs, no sign up to read, ad supported; try broadband internet.

cell: 917 825 3035 in DFW
email: netsql at roomity.com


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



Re: Select Options Question

2005-09-01 Thread Frank W. Zammetti
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=jk12341Group 1/option
option value=34t1fv1Group 2/option
option value=32fq21Group 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 1Group
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]



Re: Select Options Question

2005-09-01 Thread BHansard

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.


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=jk12341Group 1/option
   option value=34t1fv1Group 2/option
   option value=32fq21Group 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 1Group
 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]





Re: Select Options Question

2005-09-01 Thread glenn . deschenes
You can also build a javascript array of the descriptions.
When the user selects the option from the list, execute a javascript 
function that will do a lookup for the description in the array and set a 
hidden form field with the description found in the array.

It may happen that the character you use to delimit the key and value will 
end up in the value and then the fun starts !

HTH,
Glenn




[EMAIL PROTECTED] 
01/09/2005 12:07 PM
Please respond to
Struts Users Mailing List user@struts.apache.org


To
Struts Users Mailing List user@struts.apache.org
cc
Struts Users Mailing List user@struts.apache.org
Subject
Re: Select Options Question






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.


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=jk12341Group 1/option
 option value=34t1fv1Group 2/option
 option value=32fq21Group 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 1Group
 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]