Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Auto submit form on page load

I'm having a bit of trouble with my current issue. Any help would be greatly appreciated.

I have a step in a 'signup process' which I don't need anymore, but I don't have time to reconfigure the entire process so I'm trying to auto submit the form on page load so it will basically skip over this step. Any thoughts?

EDIT: Sorry, I should mention, originally there were two submit options, I got rid of one, now I just want to submit the 'mem_type' option on page load. not sure if that makes much of a difference.

<form method=post action="<?=$base_href.url("signup")?>" name="member_signup"> <input type=hidden name="process" value="facility_info"> <input type=hidden name="create_order" value="true">  <?php     foreach ($_POST as $k=>$d) {         if ($k === 'textarea') continue;         echo "<input type=hidden name=\"".strip_tags($k)."\" value=\"".strip_tags($d)."\">";     } ?>  <input type="submit" value="submit" name="mem_type" border="0"> </form> 
like image 594
MDez Avatar asked May 16 '13 16:05

MDez


People also ask

How do I Auto submit a form on page load?

How to Submit Form Automatically On Page Load In JavaScript. Below JavaScript code helps to submit form on load instead of clicking submit button. Use the Form name exactly, as it is used in the HTML page. Add this onload function to body tag, we are executing onLoadSubmit function on page load.

What is document forms 0 submit ()?

forms[0]. submit will trigger the submission of the first form in your HTML page. Indeed, documents. forms contains all the forms of your document. You can access them with their name attribute or their index.

Can you submit form using JavaScript?

Generally, a form is submitted when the user presses a submit button. However, sometimes, you may need to submit the form programmatically using JavaScript. JavaScript provides the form object that contains the submit() method. Use the 'id' of the form to get the form object.


1 Answers

Try this On window load submit your form.

window.onload = function(){   document.forms['member_signup'].submit(); } 
like image 115
Anoop Avatar answered Sep 19 '22 08:09

Anoop