Solved

Execute Form post on page load

Posted on 2009-05-13
3
198 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…
Suggested Courses

617 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