You can use the "onChange" method of the <SELECT> tag like this:

<SELECT name="one" onChange="javascript:myOnChange();">
<option value="id1">opt1
<option value="id2">opt2
<SELECT>

Than you write your JS function like this:

function myOnChange()
{
        var selIndex = document.YourForm.one.selectedIndex;
        var selValue = document.YourForm.one.options[selIndex];
        //of course you do all this if you need your the value property of
the     //<OPTION> element.

        document.location.href="$link.setAction("YourAction")?param1="
                                        +selValue;

}

-------------------
Daniel Moldovan
Java Developer
LEVEL 7
Bucovinei 59D
1900 Timisoara
tel. 056/224872
-------------------


-----Original Message-----
From: Mooslechner Martin [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, December 05, 2001 10:12 AM
To: '[EMAIL PROTECTED]'
Subject: Action Events triggered by JavaScript

Hi,

I would like to have my Action Event to be triggered by JavaScript in such a
way that I use the JavaScript form.submit() method to achieve this. However,
if I use this method, I don't have any idea how to tell the Javascript
_which_ button should have been pressed (there is no
name="eventSubmit_doSomething" being sent with the form). But this is
essential to the Action Event Structure!

I also don't know how I could add some kind of extra <input> field with the
appropiate information (i.e. ...name="eventSubmit_doSomething").

Does anyone of you have any ideas on this?

thanks,
Martin

PS. What I'm trying to do is: I have 2 <select> boxes where the one is
dependent from the other; if I change one of them, the possible values in
the other <select> box should change. Now I want the first <select> box
trigger the Action Event, which then changes the context variable for the
second <select> box. Until now I have done this with a seperate button
beside the one <select> box, called "apply". This works. However, it would
be nice to handle this automatically, so the user doesn't have to press
"apply" everytime s/he changes the first <select> box...



--
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