Solved

Execute Form post on page load

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

830 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