Solved

Execute Form post on page load

Posted on 2009-05-13
3
193 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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
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…

803 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