473,395 Members | 1,936 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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
9 24722
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
16,027 Expert Mod 8TB
Unfortunately, I don't think Firefox supports this.
Feb 27 '07 #5
dmjpro
2,476 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
16,027 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
16,027 Expert Mod 8TB
The below does not work on Firefox. Any hints?
Welcome to TSDN!

Try this example/tutorial.
Aug 2 '07 #9
drhowarddrfine
7,435 Expert 4TB
You are missing quotes around some of the attribute names.
Are you using a doctype?
Aug 2 '07 #10

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

Similar topics

2
by: Ron Brennan | last post by:
Good afternoon. The entire task that I'm trying to achieve is to allow a user to browse and upload multiple files simultaneously, hiding the Browse button of <input> tags of type="file" and...
1
by: Ed | last post by:
Is there a way to replace the file browse button using a JPG? <input type=file name=filename>
4
by: Werner Kaiser | last post by:
Hi, I want to change the text for the file-browse button within a form: I have something like that: <FORM ENCTYPE="multipart/form-data" ACTION="<?php echo basename(__FILE__)...
5
by: Ron Brennan | last post by:
Good afternoon. The entire task that I'm trying to achieve is to allow a user to browse and upload multiple files simultaneously, hiding the Browse button of <input> tags of type="file" and...
5
by: Codeman II | last post by:
Hi there, I am building a form where the user must upload a picture and fill in his details. Now I have a problem as all of this is on the same form. How will I be able to have the Browse...
4
by: acord | last post by:
Hi, I want to change the name of Browse to Add... How can I modify the followoing html code? <form name="iform" action="" method="post" enctype="multipart/form-data"> <input id="file"...
3
by: oopaevah | last post by:
I want to have a separate button which invokes the "browse" button on an input type=file. In internet explorer the following code works ok, in firefox nothing happens. All I do is call click()...
5
by: hrpreet | last post by:
Hi All, I need the file chooser in the jsp, just for brosing and saving the file path in the database, so i have used the following code.I dont need to read the file content. I have to make it...
9
by: shapper | last post by:
Hello, Is there a way to make the browse button an image? Thanks, Miguel
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.