I think I see where you are going....try setting the form action instead: <SCRIPT language="JavaScript"> function submitForm(form) { document.frm.action="lookup.do"; // <--Change this to not be hard-coded form.submit(); return true; } </SCRIPT>
<form name="frm" action="?" method="GET"> <input type="hidden" name="action" value=""> <select name="crn" onclick="submitForm(this.form)"> <option value="Test" selected>Test</option> <option value="Test2">Test2</option> </select> <br> <input type="submit" name="action" value="Submit"> </form> On Friday 11 July 2003 15:00, Shyam A wrote: > James, > > Thanks for your mail. I guess I need to elaborate a little bit. My HTML > form can be submitted in 2ways. 1. Clicking the "Submit" button. > 2. Clicking the drop-down > > Clicking the drop-down triggers a different action than clicking the > "Submit" button. Selecting a value in the drop-down would submit the form > and populate some of the other fields in the form. This is done before the > "Submit" button is clicked. So, I need to distinguish the action of > clicking the drop-down from clicking the "Submit" button and I called it > "Lookup". > > Both actions would be identified with a single property in the ActionForm > class - action. > > eg: > <html:submit property="action" value="Submit"/> > > I would like to set this "action" property value to "Lookup" on clicking > the drop-down using Javascript. I guess a hidden field would not serve the > purpose as I already have "action" property defined for the Submit button. > > Look forward to your help/suggestions. > > Thanks, > Shyam > > James Mitchell <[EMAIL PROTECTED]> wrote: > > You will need to create a hidden field named "action", with a value of > "Lookup": > > > > My question to you is....why "Lookup"? What does that have to do with your > form? > > > Here's a sample: > > > function submitForm(form) { > form.action.value="Lookup"; > form.submit(); > return true; > } > > > > [input] > Test Test2 > > On Friday 11 July 2003 14:15, Shyam A wrote: > > Hi, > > > > I have an HTML form with Submit and Cancel buttons, and a drop down list, > > which when clicked submits the form. I use Javascript to submit the form > > when the dropdown list is clicked. I have a property called "action" > > defined in my ActionForm class that identifies the Submit and Cancel > > buttons in the HTML form. When the drop-down is clicked, I would like to > > set the value of this "action" property to "Lookup". > > > > My Javascript function is given below: > > > > ################ > > > > > > function submitForm(form) > > { > > form.action.value="Lookup"; > > form.submit(); > > return true; > > } > > ################# > > > > and I invoke this function in my HTML form as shown below: > > > > ######################### > > > > Test > > > > ########################### > > > > But, the value of the property "action" is not set to "Lookup". > > > > Any help would be greatly appreciated. > > > > Thanks, > > Shyam > > > > > > --------------------------------- > > Do you Yahoo!? > > SBC Yahoo! DSL - Now only $29.95 per month! -- James Mitchell Software Developer/Struts Evangelist http://www.struts-atlanta.org 678-910-8017 AIM:jmitchtx --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]