null or not an object error

A

Anonymous

Guest
Can someone identify the mistake in the following simple code or suggest a better way to reload a form?

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<script language="JavaScript">
function reloadform() {
document.form.outx.submit();
}
</script>
</head>
<body>
<form name='outx' action='index.php'>
<select name='sel1' onchange="javascript: reloadform()">
<option>A</option><option>B</option><option selected>C</option>
</select>
<select name='sel2'>
<option>1</option><option selected>2</option><option>3</option>
</select>
Submit:<input type='submit' value='Submit me'> 
</form>
</body>
</html>

I keep getting the following error:

"document.form.outx is null or not an object."

when trying to change the selection from the first option list.
Thanks.
 
Yes. You are right. It works fine now. Thanks
Would you know what has to be changed if I need to load a different page than the default action value of the form?
 
somewhere you would have to put:

Code:
document.outx.action = "someaction.php"

to set the action to someaction.php
 
you can either use
Code:
document.forms['outx']
object to access that form's properties
 
Back
Top