Advertisement

11.12.2002 at 12:01PM PST, ID: 20396596
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

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

Tags: input, file, browse, button
I 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 5+.  Thanks!

<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>
Start your free trial to view this solution
Question Stats
Zone: Web Development
Question Asked By: mbleser
Solution Provided By: ivanmata
Participating Experts: 10
Solution Grade: A
Views: 1142
Translate:
Loading Advertisement...
11.12.2002 at 01:16PM PST, ID: 7440141

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
11.12.2002 at 01:59PM PST, ID: 7440355

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
11.12.2002 at 02:06PM PST, ID: 7440383

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
11.12.2002 at 02:12PM PST, ID: 7440401

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
11.12.2002 at 02:17PM PST, ID: 7440419

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
11.12.2002 at 02:23PM PST, ID: 7440439

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.08.2003 at 06:13AM PST, ID: 7685842

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.08.2003 at 07:37AM PST, ID: 7686501

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.13.2003 at 08:52AM PST, ID: 7943149

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.19.2003 at 07:02PM PST, ID: 7985097

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.10.2004 at 12:17AM PST, ID: 10558829

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.18.2004 at 03:40AM PST, ID: 10622901

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.22.2004 at 11:14AM PST, ID: 10651678

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.22.2004 at 11:22AM PST, ID: 10651749

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.22.2004 at 06:05PM PST, ID: 10654520

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.25.2005 at 06:12AM PST, ID: 13403017

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
11.12.2002 at 01:16PM PST, ID: 7440141

Rank: Master

And does anything get uploaded?
 
11.12.2002 at 01:59PM PST, ID: 7440355
I'm actually not trying to upload a file...just retreiving the file name.  Which does correctly get passed to the jsp.  

So, all post functitonality is working correctly.  Its just an annoyance (and unacceptable) for our users to have to click the Submit button twice.
 
11.12.2002 at 02:06PM PST, ID: 7440383
extrange behavior!

I guess this should be enough:


<html>
<head></head>

<form name="test_form" method="post" action="test.jsp">


<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;browse.disabled=true"
      value="Select a File...">        



<!-- 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>

Try it! =0)
Accepted Solution
 
11.12.2002 at 02:12PM PST, ID: 7440401
Cool!  I don't think I would have thought of that solution.  Thanks so much...works perfectly!

:)
 
11.12.2002 at 02:17PM PST, ID: 7440419

Rank: Guru

another way:


<html>
<head></head>


<form name="test_form" method="post" action="javascript:alert('submitted');">

<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="document.dummy.browse.click();this.form.file.value=document.dummy.browse.value;"
      value="Select a File...">        



<!-- must be clicked twice for the form to submit! -->
<input type="submit"
      name="submit"
      value="Submit The Form Now!"
      style="font-style:veranda; font-size:12px;" >
</form>

<form name="dummy">

</form>

</body>
</html>
 
11.12.2002 at 02:23PM PST, ID: 7440439
Excellent.  Thanks for your respone as well!
 
01.08.2003 at 06:13AM PST, ID: 7685842
I think the filename wasn't passed to PHP scripts if you use this method but I could be wrong. Can anyone verify? As I used this method to change my browse buttons, my php script spewed out error saying that it didn't get any values from the form submitted. Thanks.
 
01.08.2003 at 07:37AM PST, ID: 7686501
I'd recommend to post your question in PHP section, so experts have access to it and try to answer it... of course you have to offer some points...

cheers =0)
 
02.13.2003 at 08:52AM PST, ID: 7943149
this method of using: onClick="browse.click();" does not work in Netscape :(
 
02.19.2003 at 07:02PM PST, ID: 7985097
If you remove the 'display: none' from the file-type input you can see what's happening...
If a file-type input field has been filled by calling on it's click() function from within javascript, when you submit the form IE seems to clear the field instead of submitting the form. Next time you hit submit this problem will no longer be there.
This is probably a security measure of IE, to prevent malicious code from uploading files the user isn't aware of uploading.
I found that only when you really click on the 'browse' button, the file will be uploaded.
 
03.10.2004 at 12:17AM PST, ID: 10558829
I've been looking for this tweak for awhile and the above code works for me but the browse button only seems to bring up the file dialog box once... then it does nothing. Any one have fix for that? Thanks!
 
03.18.2004 at 03:40AM PST, ID: 10622901
any idea how can we browse through or select folders instead of files using input type=file element. Or any other element/type of inpur tag is also acceptable. I want th user to specify the path for the folder.

Thanks in advance.
Vivek.
 
03.22.2004 at 11:14AM PST, ID: 10651678
Evolkid22,

I just changed the browse.disabled=true; to browse.disabled=false
Hope that helps.

S.
 
03.22.2004 at 11:22AM PST, ID: 10651749
Erm, I'll get my metaphorical coat.
Don't change the browse.disable=true at the end, just slap a browse.disabled=false at the beginning of the line.

onClick="browse.disabled=false;browse.click();file.value=browse.value;browse.disabled=true"
 
03.22.2004 at 06:05PM PST, ID: 10654520
I was actually using this to pass a file, but Cold Fusion I was unable to access any file object on the form, although it was listed in the form field, for some reason it is inaccessible once you process the script. It's a nice try to satisfy the graphic designer, but I'm more inclined to tell him, tough luck. :) We'll wait till the w3 or other html committiees decide we are worthy enough of having the ability to alter the browse button. If someone can show me this works in CF I'll glady use it but otherwise...
 
02.25.2005 at 06:12AM PST, ID: 13403017
This was an excellent trick! I found an answer in your question mbleser!
Thanks
 
 
20080236-EE-VQP-29