I want to submit a <form>
with <table>
inside it. How to submit that <form>
with default action? With <select>
tag I can submit a form with onchange
javascript function. I thought that onclick="this.form.submit"
inside <td>
tag would solve, but firebug indicates error: TypeError: this.form is undefined
What is wrong?
<div class="report">
<form method="post" name="status_students">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="tdreport">Active</td>
<td class="tdreport">Unstable</td>
<td class="tdreport">Inactive</td>
</tr>
<tr>
<td class="active" name="students_actives" value="actives" onclick="this.form.submit()">
<?php
if ($this->siteCenterSelected == "All") {
echo count($this->usersStatus['verde']);
} else {
echo count($this->usersStatusSiteCenter['verde']);
}
?>
</td>
<td class="unstable"><?php
if ($this->siteCenterSelected == "All") {
echo count($this->usersStatus['amarelo']);
} else {
echo count($this->usersStatusSiteCenter['amarelo']);
}
?>
</td>
<td class="inactive"><?php
if ($this->siteCenterSelected == "All") {
echo count($this->usersStatus['vermelho']);
} else {
echo count($this->usersStatusSiteCenter['vermelho']);
}
?>
</td>
</tr>
</table>
</form>
</div>
this
object you're referring to in the onclick function is the clicked td
, not the entire document. You may want to use this instead:
onclick="document.forms[0].submit()"
But indeed, you should better refer to the form by its ID instead.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.