Submitting a form without user intervention

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Don

    Submitting a form without user intervention

    I have a need to submit a form, but don't need the user to click on a button. How do I do this? Is
    there some way, using JavaScript, to setup a <form> tag to do this?

    Thanks,
    Don


    ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
    ---= East/West-Coast Server Farms - Total Privacy via Encryption =---
  • Ivo

    #2
    Re: Submitting a form without user intervention

    "Don" <no@adr.com> asks[color=blue]
    > I have a need to submit a form, but don't need the user to click on a[/color]
    button. How do I do this? Is[color=blue]
    > there some way, using JavaScript, to setup a <form> tag to do this?
    >
    > Thanks,
    > Don
    >[/color]
    The question is of course what way the user (or some 'background process')
    should submit your form in your alternative scenario. Onload of the window?
    Onkeypress anywhere? Anyhow you are probably going to use the notorious
    submit() method in some form or other. Like so:

    <script type="text/javascript">
    document.forms[0].submit();
    </scipt>

    Submitting a form destroys the existing page and loads a new one from the
    server. It is impossible to submit multiple forms or perform any action
    after submit() has been called.
    Depending on the contents of the form elements, some confirmation dialog
    browser windows may be unavoidable before the final Submission.

    HTH
    --
    Ivo



    Comment

    • Don

      #3
      Re: Submitting a form without user intervention

      On Wed, 1 Dec 2004 07:11:06 +0100, "Ivo" <no@thank.you > wrote:
      [color=blue]
      >"Don" <no@adr.com> asks[color=green]
      >> I have a need to submit a form, but don't need the user to click on a[/color]
      >button. How do I do this? Is[color=green]
      >> there some way, using JavaScript, to setup a <form> tag to do this?
      >>
      >> Thanks,
      >> Don
      >>[/color]
      >The question is of course what way the user (or some 'background process')
      >should submit your form in your alternative scenario. Onload of the window?
      >Onkeypress anywhere? Anyhow you are probably going to use the notorious
      >submit() method in some form or other. Like so:
      >
      ><script type="text/javascript">
      > document.forms[0].submit();
      ></scipt>
      >
      >Submitting a form destroys the existing page and loads a new one from the
      >server. It is impossible to submit multiple forms or perform any action
      >after submit() has been called.
      >Depending on the contents of the form elements, some confirmation dialog
      >browser windows may be unavoidable before the final Submission.
      >
      >HTH[/color]
      I'm not sure I follow you here. I don't want any user intervention. Yet, I want to submit the
      <form> to the server PHP script. The script that submit's the <form> will be doing some data
      manipulation, but there's no need for the user to have to click on anything. When the data
      manipulation is done I want a <form> to be submitted to another server-side PHP script.

      Don


      ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
      http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
      ---= East/West-Coast Server Farms - Total Privacy via Encryption =---

      Comment

      • J. J. Cale

        #4
        Re: Submitting a form without user intervention

        "Don" <no@adr.com> wrote in message
        news:mgpqq01vdr uodb2k8t0333if1 un42jn54q@4ax.c om...[color=blue]
        > On Wed, 1 Dec 2004 07:11:06 +0100, "Ivo" <no@thank.you > wrote:
        >[color=green]
        > >"Don" <no@adr.com> asks[color=darkred]
        > >> I have a need to submit a form, but don't need the user to click on a[/color]
        > >button. How do I do this? Is[color=darkred]
        > >> there some way, using JavaScript, to setup a <form> tag to do this?
        > >>
        > >> Thanks,
        > >> Don
        > >>[/color]
        > >The question is of course what way the user (or some 'background[/color][/color]
        process')[color=blue][color=green]
        > >should submit your form in your alternative scenario. Onload of the[/color][/color]
        window?[color=blue][color=green]
        > >Onkeypress anywhere? Anyhow you are probably going to use the notorious
        > >submit() method in some form or other. Like so:
        > >
        > ><script type="text/javascript">
        > > document.forms[0].submit();
        > ></scipt>
        > >
        > >Submitting a form destroys the existing page and loads a new one from the
        > >server. It is impossible to submit multiple forms or perform any action
        > >after submit() has been called.
        > >Depending on the contents of the form elements, some confirmation dialog
        > >browser windows may be unavoidable before the final Submission.
        > >
        > >HTH[/color]
        > I'm not sure I follow you here. I don't want any user intervention. Yet,[/color]
        I want to submit the[color=blue]
        > <form> to the server PHP script. The script that submit's the <form> will[/color]
        be doing some data[color=blue]
        > manipulation, but there's no need for the user to have to click on[/color]
        anything. When the data[color=blue]
        > manipulation is done I want a <form> to be submitted to another[/color]
        server-side PHP script.[color=blue]
        >
        > Don[/color]

        As Ivo explains this is easy enough to do but there are things you should
        consider in addition to his remarks.
        When the form is submitted the clients page WILL be refreshed!!! Even if
        you put everything back this could be very annoying! Especially since the
        user will not be expecting it.

        I suggest you post some code and explain what you are doing; tracking user
        actions, tracking internal link usage, or just validating form data and
        submitting when you have enough info or whatever. Be more specific and you'l
        l be pointed in the right direction.
        Jimbo


        Comment

        • Don

          #5
          Re: Submitting a form without user intervention

          On Wed, 1 Dec 2004 09:22:49 +0200, "J. J. Cale" <photom@netvisi on.net.il> wrote:
          [color=blue]
          >"Don" <no@adr.com> wrote in message
          >news:mgpqq01vd ruodb2k8t0333if 1un42jn54q@4ax. com...[color=green]
          >> On Wed, 1 Dec 2004 07:11:06 +0100, "Ivo" <no@thank.you > wrote:
          >>[color=darkred]
          >> >"Don" <no@adr.com> asks
          >> >> I have a need to submit a form, but don't need the user to click on a
          >> >button. How do I do this? Is
          >> >> there some way, using JavaScript, to setup a <form> tag to do this?
          >> >>
          >> >> Thanks,
          >> >> Don
          >> >>
          >> >The question is of course what way the user (or some 'background[/color][/color]
          >process')[color=green][color=darkred]
          >> >should submit your form in your alternative scenario. Onload of the[/color][/color]
          >window?[color=green][color=darkred]
          >> >Onkeypress anywhere? Anyhow you are probably going to use the notorious
          >> >submit() method in some form or other. Like so:
          >> >
          >> ><script type="text/javascript">
          >> > document.forms[0].submit();
          >> ></scipt>
          >> >
          >> >Submitting a form destroys the existing page and loads a new one from the
          >> >server. It is impossible to submit multiple forms or perform any action
          >> >after submit() has been called.
          >> >Depending on the contents of the form elements, some confirmation dialog
          >> >browser windows may be unavoidable before the final Submission.
          >> >
          >> >HTH[/color]
          >> I'm not sure I follow you here. I don't want any user intervention. Yet,[/color]
          >I want to submit the[color=green]
          >> <form> to the server PHP script. The script that submit's the <form> will[/color]
          >be doing some data[color=green]
          >> manipulation, but there's no need for the user to have to click on[/color]
          >anything. When the data[color=green]
          >> manipulation is done I want a <form> to be submitted to another[/color]
          >server-side PHP script.[color=green]
          >>
          >> Don[/color]
          >
          >As Ivo explains this is easy enough to do but there are things you should
          >consider in addition to his remarks.
          >When the form is submitted the clients page WILL be refreshed!!! Even if
          >you put everything back this could be very annoying! Especially since the
          >user will not be expecting it.
          >
          >I suggest you post some code and explain what you are doing; tracking user
          >actions, tracking internal link usage, or just validating form data and
          >submitting when you have enough info or whatever. Be more specific and you'l
          >l be pointed in the right direction.
          >Jimbo
          >[/color]
          I have a erver-side PHP script that processes possible upload files, and also prepares some <input>
          tags from data sent by the client-side page that invoked this PHP script. If there were any
          uploaded files I print a message indicating the upload was successful, and I want the user to have
          time to read the message. Therefore, I want him to click on a "continue" button. However, if there
          were no uploads, I still want to do some <input> tag preparation from data sent by the invoking
          page, but don't need to display anything, and don't need the user to click on a button. In either
          case, the <form> tag has the same "action" element. Just want a button in one case, and not in the
          other. How do I go about this?

          Thanks for your help, both of you guys.
          Don


          ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
          http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
          ---= East/West-Coast Server Farms - Total Privacy via Encryption =---

          Comment

          • Don

            #6
            Re: Submitting a form without user intervention

            On Wed, 1 Dec 2004 07:11:06 +0100, "Ivo" <no@thank.you > wrote:
            [color=blue]
            >"Don" <no@adr.com> asks[color=green]
            >> I have a need to submit a form, but don't need the user to click on a[/color]
            >button. How do I do this? Is[color=green]
            >> there some way, using JavaScript, to setup a <form> tag to do this?
            >>
            >> Thanks,
            >> Don
            >>[/color]
            >The question is of course what way the user (or some 'background process')
            >should submit your form in your alternative scenario. Onload of the window?
            >Onkeypress anywhere? Anyhow you are probably going to use the notorious
            >submit() method in some form or other. Like so:
            >
            ><script type="text/javascript">
            > document.forms[0].submit();
            ></scipt>
            >
            >Submitting a form destroys the existing page and loads a new one from the
            >server. It is impossible to submit multiple forms or perform any action
            >after submit() has been called.
            >Depending on the contents of the form elements, some confirmation dialog
            >browser windows may be unavoidable before the final Submission.
            >
            >HTH[/color]
            Got it working just great. Thanks for your help Ivo.
            Don

            Comment

            Working...