Hi Ron, I saw that somebody else had replied and had given you (somewhat) conflicting, 
but still good, advice regarding this.  

An important question is this:  do you want to have the page refresh from the server 
when a user clicks on the selection in the drop-down box (very annoying for the 
user!), or do you want to be able to handle this entirely on the client-side in the 
browser?  

A client-side solution is preferable, IMHO, if you can get away with it, because it 
will be much more responsive to the user.  There are two tradeoffs with the 
client-side approach, however.  One is that you need to write client-side javascript, 
and your requirements may dictate that you cannot do this (i.e. if you have to deal 
with users who have javascript disabled, or browsers that don't support javascript).  
The second tradeoff comes if you have a lot of data, because for the client-side 
solution to work you need to populate a javascript array(s) with every possible value 
of therapyCode and therapyDesc, and write it all to the html page, every time someone 
requests the page from the server.  The cost of doing this processing for every page 
hit may make this unfeasible (esp. in a high-volume website)...you can also run into 
cases where the amount of data is so big that writing it all to a javascript array on 
the page makes the page too large to be practical.

So, before I offer any more advice, first tell me if you think you'd want to do this 
with a client-side or server-side approach!

Paul

-----Original Message-----
From: Rea, Ron [mailto:[EMAIL PROTECTED]]
Sent: August 28, 2002 2:38 PM
To: 'Struts Users Mailing List'
Subject: RE: html:select and collection display


Paul,

Thanks for the reply!  I tried to get an example of a JSP using "onchange",
but have not been able to come up with a complete example which also uses
the <html:select> tag.  It would sure be a great help if you could point me
in the direction of one!  

Thanks,
Ron

-----Original Message-----
From: Galbraith, Paul [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, August 28, 2002 4:37 AM
To: Struts Users Mailing List
Subject: RE: html:select and collection display

Ron, where exactly are you wanting to display the therapyDesc?  You'll want
to use the onClick or onChange javascript event handlers of the html:select
tag.  You'll need to write some javascript that can identify the therapyCode
and display the matching therapyDesc.  I hope that's a start in the right
direction for you, and I'm not telling you something you already know...if
you're not sure how to do this, just ask.

Paul

-----Original Message-----
From: Rea, Ron [mailto:[EMAIL PROTECTED]]
Sent: August 27, 2002 1:23 PM
To: '[EMAIL PROTECTED]'
Subject: html:select and collection display


Hello All, 
 
I'm still pretty new to Struts, so maybe this is really simple, but I can't
figure it out for the life of me.  I am displaying a drop-down within a JSP.
The collection contains a therapyCode and a therapyDesc, the drop-down
displaying the therapyCode.  What I need to do is, once the therapyCode is
selected from the drop-down, also display the therapyDesc for that
therapyCode.  Any ideas as to how to do this???
 
Collection: therapyArrayList
===========================
therapyCode
therapyDesc 
 
Code to display drop-down:
<html:select property="therapyCode1" size="1"> 
<html:options collection="therapyArrayList"
    property="therapyCode"
    labelProperty="therapyCode"/> 
</html:select>
 

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

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

Reply via email to