SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict Feudalism's Avatar
    Join Date
    Jun 2002
    Location
    Buenos Aires, Argentina
    Posts
    361
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question automatic submit.form

    I have a form, pointing to a CGI. All the form fields are hidden, and I need to make the form submiting automatically as the page loads. Look

    -------------------------
    <form id="aForm" method="POST" action="/cgi-bin/formtomail.cgi" onSubmit="doSubmit(this.form)">
    <input type="hidden" name="subject" value="Comentario para la FADM">
    <input type="hidden" name="recipient" value="pepe@parada.com">
    <input type="hidden" name="redirect" value="apage.htm">
    <input type="hidden" name="mail" value=pepe@hotmail.com">
    </form>

    Now, I need to make the form submit, but without any button. I was told by a friendly poster that something like..


    <script type="text/javascript">
    form.submit()
    </script>

    Should work, but it tells me that the object "form" is not present. There should be a formulae.

    Thanx.

  2. #2
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <body onload="document.forms['aForm'].submit()">
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev





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
  •