Jump to content

Submitting without clicking a button


martin.kahil

Recommended Posts

Hi everyone. need some help again.I have a code that generates some links, and I want the user to click that link and that information will be posted... I have tried this with javascript

<script>function send(day){document.getElementById('day').value=day;//some code that lets the button be clicked}</script><br /><br /><br /><br /><br /><form method="post" action="ShowSalry.php"><input type="hidden" name="day"><input type="submit" visiable="false"></form><a OnClick="send(4)">click 4"</a>

The problem is that I don't know how to post without clicking the submit button.(by the way, if somebody know how to prevent the browser from showing the button it will be great)

Link to comment
Share on other sites

to stop the button to be displayed, just put in the code style="display:none;"... but to post it with out clicking the button... you could trydocument.getElementById('formname').submit=submitbut I am not sure if that would work, I havent tried it...there is another topic on this, http://w3schools.invisionzone.com/index.php?showtopic=16533 ... you could try looking there.

Link to comment
Share on other sites

to stop the button to be displayed, just put in the code style="display:none;"... but to post it with out clicking the button... you could trydocument.getElementById('formname').submit=submitbut I am not sure if that would work, I havent tried it...there is another topic on this, http://w3schools.invisionzone.com/index.php?showtopic=16533 ... you could try looking there.
You'll need to give the form an id:
<form id="myformid" method="post" ...

and the javascript is

document.getElementById('myformid').submit()

To stop the submit button showing, just remove it!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...