Disable a button on first click

Discussion in 'ASP .Net' started by Stuart Quinn, Aug 5, 2006.

  1. Stuart Quinn

    Stuart Quinn Guest

    Is there a way to disable a button to disallow a user to click on it more
    than once?

    Thanks!
     
    Stuart Quinn, Aug 5, 2006
    #1
    1. Advertising

  2. Stuart Quinn

    Kumar Reddi Guest

    try using the oneClick control from Metabuilders

    http://www.metabuilders.com/Tools/OneClick.aspx

    "Stuart Quinn" <> wrote in message
    news:aS7Bg.410$-kc.rr.com...
    > Is there a way to disable a button to disallow a user to click on it more
    > than once?
    >
    > Thanks!
    >
    >
     
    Kumar Reddi, Aug 5, 2006
    #2
    1. Advertising

  3. Stuart Quinn

    Scott M. Guest

    Add client-side javascript: onClick="nameOfButton.enabled=false"


    "Kumar Reddi" <> wrote in message
    news:uF$...
    > try using the oneClick control from Metabuilders
    >
    > http://www.metabuilders.com/Tools/OneClick.aspx
    >
    > "Stuart Quinn" <> wrote in message
    > news:aS7Bg.410$-kc.rr.com...
    >> Is there a way to disable a button to disallow a user to click on it more
    >> than once?
    >>
    >> Thanks!
    >>
    >>

    >
    >
     
    Scott M., Aug 5, 2006
    #3
  4. Stuart Quinn

    jmnobre Guest

    The solution maily depends on your client's browser capabilities...
    If you can ensure that javascript is enabled, then you can add the
    following script:

    C#:
    yourButton.Attributes.Add( "onClick='yourButton.enabled=false;'");

    The problem is if your site is public and you cannot ensure that your
    clients all have javascript enabled!
    In that case, you can only rely on server side code, and you have to
    ensure that if 2 posts came from the same client, all but the 1st will
    be ignored!



    Stuart Quinn wrote:
    > Is there a way to disable a button to disallow a user to click on it more
    > than once?
    >
    > Thanks!
     
    jmnobre, Aug 6, 2006
    #4
  5. Stuart Quinn

    Riki Guest

    jmnobre wrote:
    > The solution maily depends on your client's browser capabilities...
    > If you can ensure that javascript is enabled, then you can add the
    > following script:
    >
    > C#:
    > yourButton.Attributes.Add( "onClick='yourButton.enabled=false;'");
    >
    > The problem is if your site is public and you cannot ensure that your
    > clients all have javascript enabled!
    > In that case, you can only rely on server side code, and you have to
    > ensure that if 2 posts came from the same client, all but the 1st will
    > be ignored!
    >
    >
    >
    > Stuart Quinn wrote:
    >> Is there a way to disable a button to disallow a user to click on it
    >> more than once?
    >>
    >> Thanks!


    If you also want to disable pressing the Enter key twice, you need
    to move the script to the onSubmit event of the form.

    Some of the caveats are discussed in a part of this article:
    http://msdn.microsoft.com/msdnmag/issues/06/09/CuttingEdge/default.aspx#S3

    --

    Riki
     
    Riki, Aug 6, 2006
    #5
  6. I guess this.enabled = false; will do as well.
    (should) save the trouble of obtaining the clientid


    "Scott M." <> schreef in bericht
    news:...
    > Add client-side javascript: onClick="nameOfButton.enabled=false"
    >
    >
    > "Kumar Reddi" <> wrote in message
    > news:uF$...
    >> try using the oneClick control from Metabuilders
    >>
    >> http://www.metabuilders.com/Tools/OneClick.aspx
    >>
    >> "Stuart Quinn" <> wrote in message
    >> news:aS7Bg.410$-kc.rr.com...
    >>> Is there a way to disable a button to disallow a user to click on it
    >>> more than once?
    >>>
    >>> Thanks!
    >>>
    >>>

    >>
    >>

    >
    >
     
    Edwin Knoppert, Aug 6, 2006
    #6
  7. Stuart Quinn

    Guest

    This will stop multiple submits.
    I got this from this newsgroup and always
    wanted to thank the author but could not locate the post..


    --aspx code--
    <script type="text/javascript">
    var submitFlag = false;
    </script>
    --end code--

    --Page Load code--
    Submit.Attributes.Add("onclick", "javascript:if(submitFlag){return
    false;}else{submitFlag=true;return true;}")
    --end code--
     
    , Aug 7, 2006
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Purvi T
    Replies:
    0
    Views:
    925
    Purvi T
    Oct 19, 2004
  2. Sinity

    Disable button after first click

    Sinity, Nov 12, 2003, in forum: ASP .Net
    Replies:
    15
    Views:
    16,038
    nayak
    Sep 4, 2007
  3. Sinity

    Disable button after first click

    Sinity, Nov 12, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    430
    Sinity
    Nov 12, 2003
  4. Amy
    Replies:
    0
    Views:
    1,029
  5. Sinity

    Disable button after first click

    Sinity, Nov 12, 2003, in forum: ASP General
    Replies:
    1
    Views:
    148
    Ray at
    Nov 12, 2003
Loading...

Share This Page