Click to See Complete Forum and Search --> : submit a form with a text link


Kr|Z
07-20-2003, 10:32 AM
Is there a way to submit a form with a text-link, but submit to another file than the one in action="" ?

thanks

Charles
07-20-2003, 11:33 AM
The problem is in keeping the page working for the 13% of users that do not use JavaScript.

<!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">
<form action="" onsubmit="return true">
<div>
<script type="text/javascript">
<!--
document.write('<a href="#">Darling, you send me</a>');
document.links[document.links.length - 1].onclick = function () {if (document.forms[0].onsubmit()) document.forms[0].submit()}
// -->
</script>
<noscript><input type="submit"></noscript>
</div>
</form>

And if you don't linke the value of the form's "action" attribute then change it.