467,091 Members | 1,246 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,091 developers. It's quick & easy.

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

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
  • viewed: 24249
Share:
9 Replies
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
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
I m also facing the same problem friend . Please help friends :-)
Feb 26 '07 #4
acoder
Expert Mod 8TB
Unfortunately, I don't think Firefox supports this.
Feb 27 '07 #5
dmjpro
2GB
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 8TB
Set the field's disabled attribute to true on submit using the form's onsubmit event handler.
Feb 27 '07 #7
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 8TB
The below does not work on Firefox. Any hints?
Welcome to TSDN!

Try this example/tutorial.
Aug 2 '07 #9
drhowarddrfine
Expert 4TB
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.

Similar topics

1 post views Thread by Ed | last post: by
4 posts views Thread by Werner Kaiser | last post: by
9 posts views Thread by shapper | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.