Click to See Complete Forum and Search --> : <td Onclick= how to submit a form?


Overtime
01-20-2003, 03:37 AM
i have to submit a form onlick on text , for example :

<td onlick=somethingThatHelpMeSolveThis(submit) > thanks</td>

hotcurry
01-20-2003, 03:59 AM
you hav to write a javascript function that carries out the submitting
eg. in the form HTML:
<A HREF="http://page to go onto after click" onClick="submitForm('formName)">SEND</A>

in the Javascript
function submitForm(sub) {
document.forms[sub].submit();
}


:)

Charles
01-20-2003, 04:48 AM
You have to allow for the one in ten users that do not use JavaScript (http://www.thecounter.com/stats/2002/November/javas.php). Thus:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<title>Form Exampla</title>
<form action="someScript.pl" name="formName">
<div>
<script type="text/javascript">
<!--
document.write('<a href="#">Submit</a>');
document.links[document.links.length-1].onclick = function () {
document.formName.submit();
return false;
}
// -->
</script>
<noscript><input type="submit"></noscript>
</div>
</form>

Overtime
01-22-2003, 12:30 AM
Thanks , really helped me out...