Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Different actions from one form.

Different actions from one form.

Scheduled Pinned Locked Moved Web Development
question
8 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    David Fleming
    wrote on last edited by
    #1

    I am wondering how (if it is possible) to do the following: You have a login form with a login ID (email address) and a password. When the user clicks the "Submit" button, go to a page that varifies the email address and password. That part I've got done -- easy. What I would like is to have another button, or a link, that will go to a different page that will send the user their password in an email. So what I'm wondering is how can this other page (the one sending the email) get the email address the user entered on the form? I would rather not simply redirect them to a second page where they enter the email address. If possible, I would like to be able to read the email address entered on the login form. Can it be done? If so, how? My understanding is that the data on the form is not available to subsequent pages until the form is submitted (which activates the "action" page, right?). Is there a way around that, or am I missing something basic? Thanks.

    J P C 3 Replies Last reply
    0
    • D David Fleming

      I am wondering how (if it is possible) to do the following: You have a login form with a login ID (email address) and a password. When the user clicks the "Submit" button, go to a page that varifies the email address and password. That part I've got done -- easy. What I would like is to have another button, or a link, that will go to a different page that will send the user their password in an email. So what I'm wondering is how can this other page (the one sending the email) get the email address the user entered on the form? I would rather not simply redirect them to a second page where they enter the email address. If possible, I would like to be able to read the email address entered on the login form. Can it be done? If so, how? My understanding is that the data on the form is not available to subsequent pages until the form is submitted (which activates the "action" page, right?). Is there a way around that, or am I missing something basic? Thanks.

      J Offline
      J Offline
      Jeremy Falcon
      wrote on last edited by
      #2

      <form action="original.html" method="post">
      <input type="text" name="email">
      <input type="password" name="passwd">
      <input type="submit" value="OK">
      <input type="button" value="Forgot Passowrd" onClick="this.form.action='newpage.html';this.form.submit();">
      </form>

      Jeremy Falcon Imputek "..." - Paul Watson  07-17

      D 1 Reply Last reply
      0
      • J Jeremy Falcon

        <form action="original.html" method="post">
        <input type="text" name="email">
        <input type="password" name="passwd">
        <input type="submit" value="OK">
        <input type="button" value="Forgot Passowrd" onClick="this.form.action='newpage.html';this.form.submit();">
        </form>

        Jeremy Falcon Imputek "..." - Paul Watson  07-17

        D Offline
        D Offline
        David Fleming
        wrote on last edited by
        #3

        It works like a charm. That's excellent. Thanks.

        1 Reply Last reply
        0
        • D David Fleming

          I am wondering how (if it is possible) to do the following: You have a login form with a login ID (email address) and a password. When the user clicks the "Submit" button, go to a page that varifies the email address and password. That part I've got done -- easy. What I would like is to have another button, or a link, that will go to a different page that will send the user their password in an email. So what I'm wondering is how can this other page (the one sending the email) get the email address the user entered on the form? I would rather not simply redirect them to a second page where they enter the email address. If possible, I would like to be able to read the email address entered on the login form. Can it be done? If so, how? My understanding is that the data on the form is not available to subsequent pages until the form is submitted (which activates the "action" page, right?). Is there a way around that, or am I missing something basic? Thanks.

          P Offline
          P Offline
          Paul Watson
          wrote on last edited by
          #4

          David Fleming wrote: I would rather not simply redirect them to a second page where they enter the email address. If possible, I would like to be able to read the email address entered on the login form. Can it be done? If so, how? Jeremy's way works well, but an alternative (always good to have options) is to have the FORM still go to the same handling ASP page, but also have a hidden text box in the FORM which tracks which button was clicked. Then in the ASP you can check which one was clicked and do whatever is appropriate. The benefit is that you can save some coding by having only one ASP page and not two. The down side is there is a bit more code (HTML and JavaScript) on the originating FORM page. If you need some help with the hidden text box method just ask... regards, Paul Watson Bluegrass Cape Town, South Africa The greatest thing you'll ever learn is just to love, and to be loved in return - Moulin Rouge Alison Pentland wrote: I now have an image of you in front of the mirror in the morning, wearing your knickers, socks and shoes trying to decided if they match!

          D 1 Reply Last reply
          0
          • P Paul Watson

            David Fleming wrote: I would rather not simply redirect them to a second page where they enter the email address. If possible, I would like to be able to read the email address entered on the login form. Can it be done? If so, how? Jeremy's way works well, but an alternative (always good to have options) is to have the FORM still go to the same handling ASP page, but also have a hidden text box in the FORM which tracks which button was clicked. Then in the ASP you can check which one was clicked and do whatever is appropriate. The benefit is that you can save some coding by having only one ASP page and not two. The down side is there is a bit more code (HTML and JavaScript) on the originating FORM page. If you need some help with the hidden text box method just ask... regards, Paul Watson Bluegrass Cape Town, South Africa The greatest thing you'll ever learn is just to love, and to be loved in return - Moulin Rouge Alison Pentland wrote: I now have an image of you in front of the mirror in the morning, wearing your knickers, socks and shoes trying to decided if they match!

            D Offline
            D Offline
            David Fleming
            wrote on last edited by
            #5

            Ah, good idea. I've already coded it the other way, but thanks for the alternative. I agree, always good to have alternatives. I've used hidden text boxes but didn't even think of that.

            1 Reply Last reply
            0
            • D David Fleming

              I am wondering how (if it is possible) to do the following: You have a login form with a login ID (email address) and a password. When the user clicks the "Submit" button, go to a page that varifies the email address and password. That part I've got done -- easy. What I would like is to have another button, or a link, that will go to a different page that will send the user their password in an email. So what I'm wondering is how can this other page (the one sending the email) get the email address the user entered on the form? I would rather not simply redirect them to a second page where they enter the email address. If possible, I would like to be able to read the email address entered on the login form. Can it be done? If so, how? My understanding is that the data on the form is not available to subsequent pages until the form is submitted (which activates the "action" page, right?). Is there a way around that, or am I missing something basic? Thanks.

              C Offline
              C Offline
              Chris Maunder
              wrote on last edited by
              #6

              Specifying multiple actions from a single Form Warning: was one of my first attempts at javascript. May explode. cheers, Chris Maunder

              D 1 Reply Last reply
              0
              • C Chris Maunder

                Specifying multiple actions from a single Form Warning: was one of my first attempts at javascript. May explode. cheers, Chris Maunder

                D Offline
                D Offline
                David Fleming
                wrote on last edited by
                #7

                In theory, very similar to the first reply I got, in that you change the ".action" to the new page. But very slick. I also liked the idea one person, who wrote a message on the article's page, had about having a single function that takes a parameter that tells it which page to redirect to. Very nifty. Thanks everyone.

                C 1 Reply Last reply
                0
                • D David Fleming

                  In theory, very similar to the first reply I got, in that you change the ".action" to the new page. But very slick. I also liked the idea one person, who wrote a message on the article's page, had about having a single function that takes a parameter that tells it which page to redirect to. Very nifty. Thanks everyone.

                  C Offline
                  C Offline
                  Chris Maunder
                  wrote on last edited by
                  #8

                  Yes - the guy "Mr Picky" is a mate of mine who wrote just to let me know that my code was messy and unweildy (What are friends for, eh? ;)) cheers, Chris Maunder

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups