Click to See Complete Forum and Search --> : onchange not generating any action.


tbirnseth
10-25-2005, 10:23 PM
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


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

Kravvitz
10-25-2005, 11:31 PM
Does it work if you remove "return true;" from the event handlers?

tbirnseth
10-26-2005, 03:10 AM
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

ccoppenbarger
10-26-2005, 04:02 PM
Just use submit(). Leave off 'this.form'

tbirnseth
10-27-2005, 12:21 AM
Just use submit(). Leave off 'this.form'

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

feras_wilson
10-27-2005, 11:06 AM
here is the right 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">

tbirnseth
10-27-2005, 12:08 PM
here is the right code:

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