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. Doubleclick

Doubleclick

Scheduled Pinned Locked Moved Web Development
javascriptdatabasesysadminhelpquestion
5 Posts 3 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.
  • L Offline
    L Offline
    Larza123
    wrote on last edited by
    #1

    Hi I have a problem that refers to dubbelclick on a button. I want to prevent the server code to run again after a second postback. I can not solve this with javascript because my clients doesn't always allow javacript. I know that a thread on the server doesn't die because of a second postback while the first thread is running but the connection to the client doesn't seemes to work for the first thread after a second postback. Often this isn't a problem but I want to redirect the client to a new page after saving data to the database. I created a function to see if it is a second postback or not so that is not my problem. I think the answer is in the threads. If you have any Idea or question please tell me. Thanx! -- modified at 8:56 Tuesday 18th April, 2006

    J A 2 Replies Last reply
    0
    • L Larza123

      Hi I have a problem that refers to dubbelclick on a button. I want to prevent the server code to run again after a second postback. I can not solve this with javascript because my clients doesn't always allow javacript. I know that a thread on the server doesn't die because of a second postback while the first thread is running but the connection to the client doesn't seemes to work for the first thread after a second postback. Often this isn't a problem but I want to redirect the client to a new page after saving data to the database. I created a function to see if it is a second postback or not so that is not my problem. I think the answer is in the threads. If you have any Idea or question please tell me. Thanx! -- modified at 8:56 Tuesday 18th April, 2006

      J Offline
      J Offline
      J4amieC
      wrote on last edited by
      #2

      The only way to do this is with Javascript - by disabling the button after the first click. You could also add a message kindly asking users not to double press the submit/save button for those that have JS switched off.

      L 1 Reply Last reply
      0
      • J J4amieC

        The only way to do this is with Javascript - by disabling the button after the first click. You could also add a message kindly asking users not to double press the submit/save button for those that have JS switched off.

        L Offline
        L Offline
        Larza123
        wrote on last edited by
        #3

        There must be a way. You can not trust a user to follow directions. If they click more then once the data will be stored twice. I can with cash and a hiddenfield check if it is a second click on the button during the first postback but I somehow lose the connection to the client with the first thread. I have done two different test and sometimes it is the same thread that executes the code on the server side for both postbacks. I don't know why. If it is the same thread then it's easy but not if it is different threads. Do you know why it is different threads sometimes? How can I get hold of the first thread and merge it with the second. Thanx!

        1 Reply Last reply
        0
        • L Larza123

          Hi I have a problem that refers to dubbelclick on a button. I want to prevent the server code to run again after a second postback. I can not solve this with javascript because my clients doesn't always allow javacript. I know that a thread on the server doesn't die because of a second postback while the first thread is running but the connection to the client doesn't seemes to work for the first thread after a second postback. Often this isn't a problem but I want to redirect the client to a new page after saving data to the database. I created a function to see if it is a second postback or not so that is not my problem. I think the answer is in the threads. If you have any Idea or question please tell me. Thanx! -- modified at 8:56 Tuesday 18th April, 2006

          A Offline
          A Offline
          alexey N
          wrote on last edited by
          #4

          Store on server the time of last data submit. When user submitting form you can calculate difference between current time and last submit time. If this difference is less than 1 second, you must ignore this submit. Best regards, Alexey.

          L 1 Reply Last reply
          0
          • A alexey N

            Store on server the time of last data submit. When user submitting form you can calculate difference between current time and last submit time. If this difference is less than 1 second, you must ignore this submit. Best regards, Alexey.

            L Offline
            L Offline
            Larza123
            wrote on last edited by
            #5

            That is almost how I did it but thats not my problem. My problem is that the first postback don't have the connection to the client if a second postback occures. Lets say that I have to store some data in my database and then I get an Id back from the database and I have to use that in a response.redirect. If there is two postbacks then the first one with the response.redirect will not do anything because the second postback is the one with the connection to the client. It doen't matter if I don't do any thing with the second postback it is stil the one with the connection to the client. I think the solution is to merger the threads or something but I don't know how. Thanx for your answers!

            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