Hi all I have an Anchr tag on whcih I am submitting a form as seen below:
<form id="myForm" action="main/postdata">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br><br>
<a onclick="myFunction()" value="Submit form">click</a>
</form>
<script>
function myFunction()
{
document.getElementById("myForm").submit();
}
</script>
is there anyway I can append the POST data with an additional value when the user clicks, so if I had 2 a tags I could establish which one was clicked? eg:
<form id="myForm" action="main/postdata">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br><br>
<a onclick="myFunction()" value="Submit form">click</a> -- ? check which 1 was clicked?
<a onclick="myFunction()" value="Submit form">click 2 </a>
</form>
I know it would be easier to use buttons to do this - but I am looking for the JS/JQUERY solution if there is one please, many thanks!