Click to See Complete Forum and Search --> : Disable a submit button with onclick?


Dr.5150
12-13-2002, 01:06 PM
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?

Dr.5150
12-13-2002, 01:56 PM
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.

Sceiron
12-13-2002, 02:54 PM
<input type="button" value="Submit" onclick="this.disabled=1; this.form.submit();">

Not tested, may need DOM tweaking.

Dr.5150
12-13-2002, 03:42 PM
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.

Dr.5150
12-13-2002, 03:44 PM
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.

ShrineDesigns
12-13-2002, 04:05 PM
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">