/    Sign up×
Community /Pin to ProfileBookmark

onchange not generating any action.

I have the following form (generated). However, when a selector is changed it is not submitting the form and I can’t see why not. Anyone have better eyes?

Thanks in advance,
tony

[code=html]
<form name=”appEnv” id=”appEnv” method=”post” action=”/cfgMgr/home.php?pg=14&appID=8&cfgEntID=19″ >
<table width=”100%” border=”0″ cellpadding=”0″ cellspacing=”0″>
<tr>
<th align=”center” width=”32%” scope=”col”>Xfer Type</th>
<th align=”center” width=”32%” scope=”col”>OS Type</th>
<th align=”center” width=”32%” scope=”col”>Server Language</th>
</tr>
<tr>
<td align=”center”>

<select name=”xferType” id=”xferType” onchange=”this.form.submit(); return true;”>
<option value=”1″ SELECTED > Local File </option>
<option value=”2″> FTP </option>
</select>
</td>
<td align=”center”>
<select name=”osType” id=”osType” onchange=”this.form.submit(); return true;”>
<option value=”1″> Unix </option>
<option value=”2″ SELECTED > Windows </option>
</select>
</td>
<td align=”center”>
<select name=”language” id=”language” onchange=”this.form.submit(); return true;”>
<option value=”1″ SELECTED > PHP </option>
<option value=”2″> ASP </option>
</select>
</td>
</tr>
</table>
<hr />
<table width=”100%” border=”0″ cellspacing=”0″ cellpadding=”0″ style=”padding-left:10px;”>
<!– Note: no table rows here because a condition was not met. Hence the hidden fields –>
<input type=”hidden” name=”ftpHost” value=”” />
<input type=”hidden” name=”ftpDir” value=”” />
<input type=”hidden” name=”ftpUser” value=”” />
<input type=”hidden” name=”ftpPassword” value=”” />
<tr>
<td colspan=”2″>&nbsp;
</td>
</tr>
<tr>
<td colspan=”2″ align=”center”>
<input type=”submit” name=”submit” value=”Update Options” />
<input type=”hidden” name=”appEnv” value=”appEnv” />
</td>
</tr>
</table>
</form>
[/code]

to post a comment
HTML

6 Comments(s)

Copy linkTweet thisAlerts:
@KravvitzOct 26.2005 — Does it work if you remove "return true;" from the event handlers?
Copy linkTweet thisAlerts:
@tbirnsethauthorOct 26.2005 — Don't know if that will work or not. I use this same code in several other areas but on this form it does not work. I'm thinking there's something simple that I'm not seeing (I checked all the quotes, etc.).

tony
Copy linkTweet thisAlerts:
@ccoppenbargerOct 26.2005 — Just use submit(). Leave off 'this.form'
Copy linkTweet thisAlerts:
@tbirnsethauthorOct 27.2005 — Just use submit(). Leave off 'this.form'[/QUOTE]

Why? I use the this.form on similar selectors and it works fine. If I leave it off, what would be behavior be for the other forms on the page? I certainly don't want them all posted.

Not sure I understand the logic of being less specific in the submit. Please educate me.

tony
Copy linkTweet thisAlerts:
@feras_wilsonOct 27.2005 — here is the right code:
[CODE]
<form name="appEnv" id="appEnv" method="post" action="/cfgMgr/home.php?pg=14&appID=8&cfgEntID=19" >
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<th align="center" width="32%" scope="col">Xfer Type</th>
<th align="center" width="32%" scope="col">OS Type</th>
<th align="center" width="32%" scope="col">Server Language</th>
</tr>
<tr>
<td align="center">

<select name="xferType" id="xferType" onchange="clickthis.click();">
<option value="1" SELECTED > Local File </option>
<option value="2"> FTP </option>
</select>
</td>
<td align="center">
<select name="osType" id="osType" onchange="clickthis.click();">
<option value="1"> Unix </option>
<option value="2" SELECTED > Windows </option>
</select>
</td>
<td align="center">
<select name="language" id="language" onchange="clickthis.click();">
<option value="1" SELECTED > PHP </option>
<option value="2"> ASP </option>
</select>
</td>
</tr>
</table>
<hr />
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="padding-left:10px;">
<!-- Note: no table rows here because a condition was not met. Hence the hidden fields -->
<input type="hidden" name="ftpHost" value="" />
<input type="hidden" name="ftpDir" value="" />
<input type="hidden" name="ftpUser" value="" />
<input type="hidden" name="ftpPassword" value="" />
<tr>
<td colspan="2">&nbsp;
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" name="submit" value="Update Options" />
<input type="hidden" name="appEnv" value="appEnv" />
</td>
</tr>
</table>
</form>
<input type="submit" style="width: 1; height:1" value="." name="clickthis">
[/CODE]
Copy linkTweet thisAlerts:
@tbirnsethauthorOct 27.2005 — here is the right code:[/QUOTE]

I'm not familiar with the clickthis.click() event. I tried to google it and it returned nothing. Can you explain to me what it does? What I want is that when the selector is changed, to submit the form it resides in.

thanks,

tony
×

Success!

Help @tbirnseth spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...