By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,873 Members | 1,040 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,873 IT Pros & Developers. It's quick & easy.

When replacing input type=file, "Browse" button, must click SUBMIT twice for form to

P: 2
am replacing the default "Browse..." button for input type=file. This works fine except that the form will only submit after the SUBMIT button is clicked twice.

Any ideas on why this is happening or a workaround? I'm testing on IE

Thanks!

[HTML]<html>
<head></head>
<body>
<form name="test_form" method="post" action="test.jsp">
<input type=file name=browse style="display: none;">
<input type=text name=file>
<input type=button
style="font-style:veranda; font-size:12px; font-weight:bold;text-transform:lowercase;color:white;background-color:#A2C382;height:22px;border-style:ridge;text-align:center;"
onClick="browse.click();file.value=browse.value;"
value="Select a File...">
<br><br>
<!-- must be clicked twice for the form to submit! -->
<input type=submit
value="Submit The Form Now!"
style="font-style:veranda; font-size:12px;">
</form>
</body>
</html>[/HTML]
Oct 27 '06 #1
Share this Question
Share on Google+
9 Replies


P: 1
Hi,

Replace onClick="browse.click();file.value=browse.value;" with

onClick="browse.click();file.value=browse.value; browse.disabled=true;"

This will solve the issue.

Thanks
Arul T
Nov 16 '06 #2

P: 7
Hi,
I used the code you guys posted, it works perfect in IE.
If I use it in Firefox, when I click on the made up browse button, ti just copies the file path from the "browse" to "file", it does not allow me to browse.

This problem only in Firefox.
I guess it is the problem with browse.click()

Any help is appreciated.
Dec 12 '06 #3

P: 2
I m also facing the same problem friend . Please help friends :-)
Feb 26 '07 #4

acoder
Expert Mod 15k+
P: 16,027
Unfortunately, I don't think Firefox supports this.
Feb 27 '07 #5

dmjpro
100+
P: 2,476
one problem i facing while i submitting the page ....

actually ... disabled fields are not sent to the server for process ....
how can i send the file information after submitting the page ....

plz hel me out ....

thanx in advance .......
Feb 27 '07 #6

acoder
Expert Mod 15k+
P: 16,027
Set the field's disabled attribute to true on submit using the form's onsubmit event handler.
Feb 27 '07 #7

P: 1
The below does not work on Firefox. Any hints?


am replacing the default "Browse..." button for input type=file. This works fine except that the form will only submit after the SUBMIT button is clicked twice.

Any ideas on why this is happening or a workaround? I'm testing on IE

Thanks!

[HTML]<html>
<head></head>
<body>
<form name="test_form" method="post" action="test.jsp">
<input type=file name=browse style="display: none;">
<input type=text name=file>
<input type=button
style="font-style:veranda; font-size:12px; font-weight:bold;text-transform:lowercase;color:white;background-color:#A2C382;height:22px;border-style:ridge;text-align:center;"
onClick="browse.click();file.value=browse.value;"
value="Select a File...">
<br><br>
<!-- must be clicked twice for the form to submit! -->
<input type=submit
value="Submit The Form Now!"
style="font-style:veranda; font-size:12px;">
</form>
</body>
</html>[/HTML]
Aug 2 '07 #8

acoder
Expert Mod 15k+
P: 16,027
The below does not work on Firefox. Any hints?
Welcome to TSDN!

Try this example/tutorial.
Aug 2 '07 #9

drhowarddrfine
Expert 5K+
P: 7,435
You are missing quotes around some of the attribute names.
Are you using a doctype?
Aug 2 '07 #10

Post your reply

Sign in to post your reply or Sign up for a free account.