Solved

Execute Form post on page load

Posted on 2009-05-13
3
191 Views
Last Modified: 2012-05-06
Hi All,

I am trying to submit a web form on page load but I can't get it to behave.

I have conditional PHP statement and if the condition is met then it loads this form with pre-filled field values.

I would like to at this point submit the form automatically. I have tried using the following javascript but it doesn't seem to be working.. does anyone have any ideas?

Thanks,

Rit
<script type="text/javascript"> 

    Window.onload = submitit;

	

	Function submitit() {

	document.getElemenById("co-shipping-method-form").submit();

	}

</script>

Open in new window

0
Comment
Question by:rito1
3 Comments
 
LVL 7

Accepted Solution

by:
Jonah11 earned 250 total points
ID: 24372824
uncapitalize "Window" and "Function" and it should work.
0
 
LVL 14

Assisted Solution

by:sam2912
sam2912 earned 250 total points
ID: 24372830

<script type="text/javascript"> 

window.onload = submitit;

        

function submitit() {

   document.getElementById("co-shipping-method-form").submit();

}

</script>

Open in new window

0
 
LVL 1

Author Closing Comment

by:rito1
ID: 31580883
Excellent, thanks.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now