www.webdeveloper.com
Results 1 to 6 of 6

Thread: Disable a submit button with onclick?

  1. #1
    Join Date
    Nov 2002
    Posts
    15

    Disable a submit button with onclick?

    I have a file upload form that will alow a user to browse for a file & then ul the file to me.


    A user can still click the browse button & the submit button while the rest of my asp script is being processed.

    What I need to know is there a way to disable a form's submit button with an onclick action & whatmore can it disable another button (the file browse) at the same time?

  2. #2
    Join Date
    Nov 2002
    Posts
    15
    I am trying this but my form post action is to an asp file that handles the ul.

    when I disable the form onsubmit the post fails.

  3. #3
    Join Date
    Dec 2002
    Location
    Sarasota, FL
    Posts
    63
    <input type="button" value="Submit" onclick="this.disabled=1; this.form.submit();">

    Not tested, may need DOM tweaking.

  4. #4
    Join Date
    Nov 2002
    Posts
    15
    Got a work around with a lil bit of javascript.

    I set a variable for each button on my form & increment them whne clicked. then if they go over my set value I pop an alert instead of processing the form.

    Thanks for responding it kinda pointed me in the direction I took.

  5. #5
    Join Date
    Nov 2002
    Posts
    15
    Originally posted by Sceiron
    <input type="button" value="Submit" onclick="this.disabled=1; this.form.submit();">

    Not tested, may need DOM tweaking.
    I tried something like this but the post still wouldn't process.

    all is good now though I got the other work around going & am satisfied with it.

  6. #6
    Join Date
    Dec 2002
    Location
    Seattle, WA
    Posts
    1,843
    try this

    <input name="myBtn" type="button" value="disabler" onClick="mySubmit.disabled=true;myFile.disabled=true">
    <input name="mySubmit" type="submit">
    <input name="myFile" type="file">

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles