T
Tim Slattery
I just ran into a situation that I wonder about. I have this HTML
file:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>form submit testing</title>
<script type="text/javascript">
function subform(code)
{
document.getElementsByName("ephReason1")[0].value=code;
document.getElementById("finishForm").submit();
}
</script>
</head>
<body>
<h1>Form testing</h1>
here's the hidden form:
<form name="EntryFormBean" method="post" action="/CES/finalEdit.do"
id="finishForm">
<div>
<input type="hidden" name="respondent" value="156078706" />
<input type="hidden" name="month" value="" />
<input type="hidden" name="year" value="" />
<input type="hidden" name="ephReason1" value="" />
<input type="submit" name="submit" value="Submit Data to BLS"
class="submit" title="Submit Data to BLS"
alt="Submit Data to BLS" />
</div>
</form>
Here are the buttons:<br/>
<input type="submit" class="submit" onclick="subform('5')"
alt="Identical data is correct" title="Identical data is correct"
value="Yes"/>
<input type="submit" class="submit"
onclick="document.getElementById('edit1').submit();"
alt="Identical data is wrong" title="Identical data is wrong"
value="No"/>
</body>
</html>
Notice the "name" attribute on the "<input type="submit"...>. With
that attribute in place, the "subform" Javascript wouldn't work.
Apparently when the script tries to call the form's "submit" method,
it gets the "submit" button instead, and can't figure out why I'm
treating it like a method.
I got around it by simply deleting the "name" property from the
"submit" button. But I wonder whether there is something I might have
done in the javascript code to get the "submit" method instead of the
button?
file:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>form submit testing</title>
<script type="text/javascript">
function subform(code)
{
document.getElementsByName("ephReason1")[0].value=code;
document.getElementById("finishForm").submit();
}
</script>
</head>
<body>
<h1>Form testing</h1>
here's the hidden form:
<form name="EntryFormBean" method="post" action="/CES/finalEdit.do"
id="finishForm">
<div>
<input type="hidden" name="respondent" value="156078706" />
<input type="hidden" name="month" value="" />
<input type="hidden" name="year" value="" />
<input type="hidden" name="ephReason1" value="" />
<input type="submit" name="submit" value="Submit Data to BLS"
class="submit" title="Submit Data to BLS"
alt="Submit Data to BLS" />
</div>
</form>
Here are the buttons:<br/>
<input type="submit" class="submit" onclick="subform('5')"
alt="Identical data is correct" title="Identical data is correct"
value="Yes"/>
<input type="submit" class="submit"
onclick="document.getElementById('edit1').submit();"
alt="Identical data is wrong" title="Identical data is wrong"
value="No"/>
</body>
</html>
Notice the "name" attribute on the "<input type="submit"...>. With
that attribute in place, the "subform" Javascript wouldn't work.
Apparently when the script tries to call the form's "submit" method,
it gets the "submit" button instead, and can't figure out why I'm
treating it like a method.
I got around it by simply deleting the "name" property from the
"submit" button. But I wonder whether there is something I might have
done in the javascript code to get the "submit" method instead of the
button?