|
|||||||
New to SitePoint Forums? Register here for free!
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
SitePoint Member
Join Date: Dec 2003
Location: kuala lumpur
Posts: 7
|
Javascript submit not working ...
Code:
<script language = "javascript">
function frmdisabletext(Form) {
frm = Form;
frm.changeuser.value = 'yes';
frm.action = 'test.php';
frm.submit();
}
</script>
<?php
$changeuser = $_POST["changeuser"];
if ($changeuser == "yes") {
$whichuser = $_POST["select_user"];
switch ($whichuser) {
case "teacher":
$disabled1 = "disabled";
break;
case "teacher_under":
$disabled2 = "disabled";
break;
case "moe":
$disabled3 = "disabled";
break;
}
}
?>
<table width="392" height="100%" border="0" cellpadding="0" cellspacing="0">
<form name="formregister" method="post" action="processRegistration.php">
<input type=hidden name="changeuser" value="">
<tr><td><table width="390" height="98%" border="0" cellspacing="0" cellpadding="0" class="tableLine" align="center">
<tr><td><br><br></td></tr>
<TR><TD>
<table width="99%" height="98%" border="0">
<tr>
<td width="5%" class="text"> </td>
<td width="35%" class="text">User Type : <?=$changeuser?></td>
<td width="54%"><select name="select_user" class="text" onChange="javascript:frmdisabletext(this.form);">
<option value="" selected>- Select User Type -</option>
<option value="teacher">Teacher</option>
<option value="teacher_under">Teacher (under training)</option>
<option value="moe">MOE Officer</option>
</select></td>
<td width="6%"> </td>
</tr>
<tr>
<td> </td>
<td class="text">Name: <br></td>
<td><input name="name" type="text" size="30" class="text"></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td class="text">State: </td>
<td><select name="select_state" class="text">
<option>Perlis</option>
<option>Kedah</option>
<option>Pulau Pinang</option>
<option>Perak</option>
<option>Selangor</option>
<option>Melaka</option>
<option>N. Sembilan</option>
<option>Johor</option>
<option>Kelantan</option>
<option>Terengganu</option>
<option>Pahang</option>
<option>Sabah</option>
<option>Sarawak</option>
<option>Wilayah P. Kuala Lumpur</option>
<option>Wilayah P. Labuan</option>
</select></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td class="text">District/Town: </td>
<td><input name="district" type="text" size="30" class="text" <?=$disabled1?><?=$disabled2?><?=$disabled3?>></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td class="text">School: </td>
<td><input name="school" type="text" size="30" class="text" <?=$disabled1?><?=$disabled2?><?=$disabled3?>></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td class="text">Level: </td>
<td><input name="level" type="text" size="5" class="text"></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td>
<table width="100%" border="0">
<tr>
<td width="82%" height="28"> </td>
<input type="submit" class="submit" name="submit" value="Submit">
<input type="reset" class="submit" name="reset" value="Reset">
</tr>
</table></td>
<td> </td>
</table></td></tr>
</table></td></tr>
</form>
</table>
It is not the page requested not found error ... it is the javascript ... cause there is an error icon in the status bar ... telling me that object doesn't support this method or property on line 6, char 4, code 0, which is : " frm.submit(); " please help ... thanx ... |
|
|
|
|
|
#2 |
|
SitePoint Enthusiast
![]() Join Date: Apr 2002
Posts: 75
|
Change onChange="java_script_:frmdisabletext(this.form);" to
onChange="frmdisabletext(this.form)" and in your script change frm.submit() to frm.submit.click(); |
|
|
|
|
|
#3 |
|
SitePoint Wizard
![]() Join Date: May 2003
Posts: 1,844
|
Here's your problem:
Code:
<input type="submit" class="submit" name="submit"...... Code:
function frmdisabletext(oSelect)
{
if (oSelect.options[oSelect.selectedIndex].value)
{
var oForm = oSelect.form;
oForm.elements.changeuser.value = 'yes';
oForm.action = 'test.php';
oForm.submit();
}
}
............
............
<select name="select_user" class="text" onchange="frmdisabletext(this);">
|
|
|
|
|
|
#4 |
|
SitePoint Member
Join Date: Dec 2003
Location: kuala lumpur
Posts: 7
|
thanx for pointing the problem to me ... it is now working as I want it to be ...
thank you adios and shoop for your replies .... ![]() |
|
|
|
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
|
All times are GMT -7. The time now is 23:01.










Linear Mode
