SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Dec 2003
    Location
    South Korea
    Posts
    232
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question about submit buttons.

    Is it possible to disable a submit button? By this i mean, you can still see it but it isn't possible to click it, like how you can in Visual Basic ( to whoever knows about this ).

  2. #2
    gingham dress, army boots... silver trophy redux's Avatar
    Join Date
    Apr 2002
    Location
    Salford / Manchester / UK
    Posts
    4,838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://www.w3.org/TR/html4/interact/forms.html#h-17.12

    to make it xhtml compliant (no attribute minimisation), something like
    Code:
    <input type="submit" value="send it off" disabled="disabled" />
    re·dux (adj.): brought back; returned. used postpositively
    [latin : re-, re- + dux, leader; see duke.]
    WaSP Accessibility Task Force Member
    splintered.co.uk | photographia.co.uk | redux.deviantart.com

  3. #3
    Beer Monster -Ox's Avatar
    Join Date
    Apr 2003
    Location
    sowth afreeka
    Posts
    374
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    something that you might want to try as well, is perhaps creating a small function for when you submit a form it disables the button, I know on any websites that I have done (most of them) I include this funtion, it prevents people from clicking the button 100 times when the submit it.

    HTML Code:
     <script type="text/javascript">
     function DisableButton() {
    	form = document.forname;
       form.elements['submit'].disabled=true;
     }
     </script>
     
    then you call it in your form like such

    HTML Code:
    <form name="forname" action="action.php" method="post" onsubmit="DisableButton();">
    <input type="text" name="name" />
    <input type="submit" name="submit" />
    </form>
    I use this especially where when I am doing payments, and I dont want users to press the submit button 5 times
    I am not sure if the above it totally bug free, but its been working like a charm for me!

    Hope this might help
    My postings are a natural product.
    The slight variations in spelling and grammar enhance its
    individual character and beauty and in no way are to be
    considered flaws or defects - http://www.guinnesspig.net


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •