Jump to content

Submit Form Using Link


grungefreak

Recommended Posts

Yes, it's possible.

 

You'll need to obtain a pointer to the "element" instance of the form then use the submit() method.  (I don't think forms are actually "element"s in the sense that I mean, but what ever.)

 

 

Like so:

 

 

 

<html>
<head>
    <title>Test</title>
    <script type="text/javascript">
    <!--
    function SubmitForm(form_id) {
        var f = document.getElementById(form_id);
        if(f != null) {
            f.submit();
        }
        return false;
    }
    //-->
    </script>
</head>
<body>
    <form id="form1" method="POST" target="form_target.php">
        Test: <input type="text" name="text">
    </form>
    <a href="#" onclick="return SubmitForm('form1');">Submit</a>
</body>
</html>

 

 

 

You could try styling a submit button though.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.