Log in

View Full Version : Auto Form



bluewalrus
02-21-2008, 06:48 PM
I have a form on my website but i wanted it to auto submit when i visit it instead of having to click the button i already have it selected. I dont know if its possible this is the code i have "<form method="post" action="address">
<input type="hidden" name="poll_id" value="poll name">
<table align=center style="font-family:Tahoma; font-size:12pt" width=304 border=1>
<tr><th align=center>Vote</td></tr>
<tr><td><input type='radio' name='vote' value='9' checked="checked"> button name <input type='submit' value=' Vote ! '></td></tr><tr><td align=center style='font-family:Tahoma; font-size:10pt'></tr>
</table>
</form>"

Jas
02-21-2008, 07:24 PM
You would need to use a language like AJAX so submit it. If you know JavaScript, it should be easy. ;) Just google for some tutorials.

Boxer
02-21-2008, 07:48 PM
I changed your code to submit the form automatically when you click on the radio button.
The onClick attribute tells the browser what to do when somebody clicks the element. The contents of the attribute is JavaScript code. It tells the browser that it should take the document, find the first form, and submit it.
If you need to submit another form, increase the number in square brackets.



<form method="post" action="address">
<input type="hidden" name="poll_id" value="poll name">
<table align=center style="font-family:Tahoma; font-size:12pt" width=304 border=1>
<tr><th align=center>Vote</td></tr>
<tr><td><input type='radio' name='vote' value='9' checked="checked" onClick="document.forms[0].submit()"> button name
<input type='submit' value=' Vote ! '></td></tr>
<tr><td align=center style='font-family:Tahoma; font-size:10pt'></tr>
</table>
</form>