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. ASP.NET
  4. clear form data (IE problem)

clear form data (IE problem)

Scheduled Pinned Locked Moved ASP.NET
helpdatabase
7 Posts 2 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.
  • P Offline
    P Offline
    Punit Belani
    wrote on last edited by
    #1

    i have one survey page (survey.aspx), on submit it inserts records in DB and redirect to (thanks.aspx). when again i used to execute same page its again insert data to DB and redirect to thanks.aspx page. but perticularly on IE(Internet explorer), second time & onwards its not inserting data and redirect to same page, i.e survey.aspx. i tried with page.forms[0].reset(); but its not working plz help. thanks in advance.

    S 1 Reply Last reply
    0
    • P Punit Belani

      i have one survey page (survey.aspx), on submit it inserts records in DB and redirect to (thanks.aspx). when again i used to execute same page its again insert data to DB and redirect to thanks.aspx page. but perticularly on IE(Internet explorer), second time & onwards its not inserting data and redirect to same page, i.e survey.aspx. i tried with page.forms[0].reset(); but its not working plz help. thanks in advance.

      S Offline
      S Offline
      Sandeep Mewara
      wrote on last edited by
      #2

      1. are you using GET method? 2. use VS debugger and check the flow. Tell us whats causing it if you are unable to resolve it.

      P 1 Reply Last reply
      0
      • S Sandeep Mewara

        1. are you using GET method? 2. use VS debugger and check the flow. Tell us whats causing it if you are unable to resolve it.

        P Offline
        P Offline
        Punit Belani
        wrote on last edited by
        #3

        i'm using like dis, function clear_form() { document.forms[0].reset(); } <form id="form1" runat="server" method="post" target="_self" onsubmit="this.clear_form();return true"> if you know any other way plz guide.

        S 1 Reply Last reply
        0
        • P Punit Belani

          i'm using like dis, function clear_form() { document.forms[0].reset(); } <form id="form1" runat="server" method="post" target="_self" onsubmit="this.clear_form();return true"> if you know any other way plz guide.

          S Offline
          S Offline
          Sandeep Mewara
          wrote on last edited by
          #4

          punit belani wrote:

          target="_self" onsubmit="this.clear_form();return true"

          It says, clear the form on submit and reload the page! Where are you doing a DB update? Redirection to other page? further, target attributes generally work with action attribute. Why have you used target here?

          P 1 Reply Last reply
          0
          • S Sandeep Mewara

            punit belani wrote:

            target="_self" onsubmit="this.clear_form();return true"

            It says, clear the form on submit and reload the page! Where are you doing a DB update? Redirection to other page? further, target attributes generally work with action attribute. Why have you used target here?

            P Offline
            P Offline
            Punit Belani
            wrote on last edited by
            #5

            actually im trying wid this, according to searching guide. the exact scenario is as i mentioned in question. so what can i do, if i want on submit first insert data and then reset the form and then redirect to thanks page?

            S 1 Reply Last reply
            0
            • P Punit Belani

              actually im trying wid this, according to searching guide. the exact scenario is as i mentioned in question. so what can i do, if i want on submit first insert data and then reset the form and then redirect to thanks page?

              S Offline
              S Offline
              Sandeep Mewara
              wrote on last edited by
              #6

              punit belani wrote:

              i want on submit first insert data and then reset the form and then redirect to thanks page

              1. submit first. Use a Submit button 2. on button click event handler, insert the data in database 3. you don't need to clear the form! As you are already going to a Thank you page. Just redirect it the thanks page. 4. Whenever a new person does a survey, the page will load afresh and the controls will auto reset. Just in case (which you shouldnt!), you have a flow where you have to reset the controls manually for such kind of survey functionality - then do it on server side for that particular scenario. Clear the controls values of that panel.

              P 1 Reply Last reply
              0
              • S Sandeep Mewara

                punit belani wrote:

                i want on submit first insert data and then reset the form and then redirect to thanks page

                1. submit first. Use a Submit button 2. on button click event handler, insert the data in database 3. you don't need to clear the form! As you are already going to a Thank you page. Just redirect it the thanks page. 4. Whenever a new person does a survey, the page will load afresh and the controls will auto reset. Just in case (which you shouldnt!), you have a flow where you have to reset the controls manually for such kind of survey functionality - then do it on server side for that particular scenario. Clear the controls values of that panel.

                P Offline
                P Offline
                Punit Belani
                wrote on last edited by
                #7

                ok fine. thanks again.

                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