Results 1 to 5 of 5
  1. #1

    Javascript to disable submit form won't submit data

    I have searched for various javascript codes to disable the submit button after submit. Including the ones taken from scripts I use on my own site but for some reason they are not working. The disable the submit button when you click it but the form isn't submitted. It just stays on the same page while the button is disabled. Is there anything I am doing wrong? Thanks.

  2. #2
    Join Date
    Aug 2002
    Location
    Bharat
    Posts
    4,722
    Have you checked this one, http://www.dynamicdrive.com/dynamici...submitonce.htm

    It seems to be working.
    Vinsar.Net - Quality Web Hosting at Economical Price on USA & European Servers
    Offering domains, shared, reseller & VPS hosting.
    Reliable Domain Reseller Account Resell Domains with Confidence

  3. #3
    Yeah I tried that one and when you clicked submit the button would be disabled but the form wouldn't perform the action. I wonder is it because my form is not directed to a new page but only uses $_POST['action']?

  4. #4
    Join Date
    May 2004
    Location
    Pflugerville, TX
    Posts
    11,222
    You could use a simple DOM scripting technique to hide the button as form data are being sent.


    Code:
    function whatev() {
    	document.getElementById('submitbutton').style.visibility = 'hidden';
    	document.getElementById('myform').submit();
    }
    Code:
    <form id="myform" method="post" action="http://www.google.com">
    <input type="submit" id="submitbutton" onclick="whatev(); return false;">
    </form>
    Studio1337___̴ı̴̴̡̡̡ ̡͌l̡̡̡ ̡͌l̡*̡̡ ̴̡ı̴̴̡ ̡̡͡|̲̲̲͡͡͡ ̲▫̲͡ ̲̲̲͡͡π̲̲͡͡ ̲̲͡▫̲̲͡͡ ̲|̡̡̡ ̡ ̴̡ı̴̡̡ ̡͌l̡̡̡̡.__Web Design

  5. #5
    Ok yeah I have learned something new. It appears as though those disable buttons do not work with you use $_POST['blah'] as the action. I use POST so that the errors appear at the top of the form that the person is using instead of being directed to another page and having to go back to the previous page to fix the errors.

Posting Permissions

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