I have a form with a javascript submit function.
I have 3 links (anchor tags) in the form & would like to set different values to the hidden parameter on submit based on the link clicked

Form submit works fine generally, but if I try to open the link in a new tab, form is not submitted. The alert within the javascript function is
not printed. Does anyone have any idea to fix this?

Below is the Sample Code : 

```
<html>

    <head>
        <script type="text/javascript">
            function submitForm(actionParam) {
            alert("in submitForm");
            document.getElementById("action").value = actionParam;
            document.forms['myForm'].action = action;
            document.forms['myForm'].submit();
        }
        </script>
    </head>

    <body>

        <form name="myForm" id="myForm" method="post" action="/businesspanel">
            <input type="hidden" id="action" name="action" value="" />

            <a href="#" onclick="submitForm('action1');">Action 1</a></span>
            <a href="#" onclick="submitForm('action2');">Action 2</a></span>
            <a href="#" onclick="submitForm('action3');">Action 3</a></span>

        </form>

    </body>
</html>

```