David,
Thanks for the advice.
I don't need a message box, just an area on the page that will display the
description of the currently selected item.
An example would be www.cars.com Here, they have a series of selection
boxes, each of which is populated depending on what the previous selection
is. I don't need anthing that fancy, just the text description, but my data
is coming from a struts bean, and I am unsure of how to get the data from
one to the other.
Thanks.
-----Original Message-----
From: David Winterfeldt [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 06, 2001 2:04 PM
To: [EMAIL PROTECTED]
Subject: Re: Struts and Javascript
I'm not sure what you are trying to do exactly. Do
you want to show a message box with a value based on
the choice from the select? You would need to create
a JavaScript array of the values you are looking for
in order to display them.
// Auto-generate the description that goes with the
key
function Project {
this.a = new Array("address.name", "Address Class
Name Value");
this.b = new Array("firstName", "First Name");
}
// Loop through the descriptions until
// you find the on matching the key
function getDescription(key) {
var oProject = new Project();
for (x in oProject) {
if (oProject[x][0] == key)
return oProject[x][1];
}
}
// Pass in the value of the select
function toggle(form) {
alert(getDescription(document.form[0].name.value));
}
This is the general idea if this is what you want to
do.
David
--- DHarty <[EMAIL PROTECTED]> wrote:
> I know this is getting out of context for for this
> list, but I've got a
> selection box populated with the name property of a
> bean. I'd like to
> display the "description" property of that bean when
> the selection changes.
> I know you can use javascript commands in the select
> option, but I am unsure
> how to user javascript to get bean properties and
> then display them:
>
> I imaging psuedo code for the process would look
> something like this:
>
> <html:select onchange="javascript: toggle();"
> size="1" property="name" >
> <html:options name="ProjectSearch"
> property="projects" />
> </html:select>
>
> function toggle() {
> Project proj = ProjectSearch.getProject(name);
> display(proj.getDescription);
> }
>
> any help would be greatly appreciated.
>
> D
>
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/