Using indexes to access page elements is not a good practice. You should
access the elements by id or through association whenever possible.
In your case, the following should be sufficient:
onchange="this.form.submit();"
If you need to do some preprocessing, I'd recommend the following pattern:
[...]
function onChangeCampaignName(aForm) {
// do preprocessing
aForm.submit();
};
[...]
<html:select property="campaignName"
onchange="onChangeCampaignName(this.form)">
[...]
Nathan.
-----Original Message-----
From: Oliver Refl� [mailto:[EMAIL PROTECTED]
Sent: Friday, April 04, 2003 5:31 AM
To: Struts
Subject: javascript and Struts
Hi Guys,
i have a strange problem. Maybe you can help me. I would like to submit a
form when a select box value
has changed.Here is the code like i try it:
<html:form action="/updateCampaign?target=update" method="POST">
<table>
<tr><td><b>Datenfeld</b></td><td><b>Wert</b></td></tr>
<tr><td>Kampagnenname:</td><td>
<html:select property="campaignName" onchange="document.submit()">
<html:option value=""/>
<html:options collection="campaignList" property="label"/>
</html:select>
</td></tr>
.......
I also trid javascript:{document.forms[0].submit()} etc. but nothing worked.
When i try this now on
a normal HTML form it works. But with the struts form i get the message.
Method not supported by object.
But i cannot imagine why this happens, cause javascript is executed on
client side and there the code
is the same.
So do you have any idea ??
Thx in advance
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]