SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: auto submit

  1. #1
    SitePoint Member
    Join Date
    Nov 2001
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    auto submit

    Hi everybody
    does anybody know how to submit a form automatically?
    I mean without clicking a button of type submit
    note:
    I used in my function
    myform.submit (myform is the form's id)
    yet nothing is submitted!

  2. #2
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by alihijazi
    Hi everybody
    does anybody know how to submit a form automatically?
    I mean without clicking a button of type submit
    note:
    I used in my function
    myform.submit (myform is the form's id)
    yet nothing is submitted!
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
    	<title>Error Handler...</title>
    	<style type="text/css" media="screen">
    	  body {margin:50px 0px;padding:0px;text-align:center;}
    	  #Content {width:500px;margin:0px auto;text-align:left;padding:15px;border:0px solid #333;background-color:#eee;}
    	</style>
    	<script type="text/javascript">
    	  function sendit(obj)
    	  {
    		obj.form.submit();
    	  }
    	</script>
      </head>
      <body>
    	<div>
    	  <form name="myform" action="http://www.sitepoint.com" method="get">
    		<input type="button" value="submit form" onclick="sendit(this);">
    		<input type="submit" value="submit">
    	  </form>
    	</div>
      </body>
    </html>

  3. #3
    SitePoint Wizard Bill Posters's Avatar
    Join Date
    Dec 2001
    Location
    UK
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try:
    Code:
    document.forms['myform'].submit()
    What specifically are you using to trigger the submit() method?

    Are you certain that you aren't disrupting user expectations by using an automatic submit on an element which is normally (and should be) a click-triggered event?
    New Plastic Arts: Visual Communication | DesignateOnline

    Mate went to NY and all he got me was this lousy signature

  4. #4
    SitePoint Member
    Join Date
    Nov 2001
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm using some kind of a timer
    when number of seconds ,minutes and hours is zero
    the form must be submitted

  5. #5
    SitePoint Addict
    Join Date
    Aug 2001
    Location
    Los Angeles, CA
    Posts
    346
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  6. #6
    SitePoint Wizard Bill Posters's Avatar
    Join Date
    Dec 2001
    Location
    UK
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by alihijazi
    I'm using some kind of a timer
    when number of seconds ,minutes and hours is zero
    the form must be submitted

    Hours?

    What process are you creating that means it could take hours for the user to submit a form?

    ---

    Fwiw, to use a timer to delay things you will need to calculate the number of milliseconds in the total delay time.

    Code:
    <script type="text/javascript">
    
    function delaySend(dly) {
    setTimeout("document.forms['myform'].submit()",dly);
    }
    
    </script>
    
    ...
    
    <body onload="delaySend('numerical value of milliseconds here')">
    New Plastic Arts: Visual Communication | DesignateOnline

    Mate went to NY and all he got me was this lousy signature


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •