Web tier: servlets, JSP, Web frameworks: replacing input type=file, click submit twice
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 and how to workaround? Many thanks!
- Posted by: Little Bee
- Posted on: November 30 2005 20:01 EST
<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 value="Select a File..." onClick="browse.click();file.value=browse.value;">
<!-- must be clicked twice for the form to submit! -->
<input type=submit value="Submit The Form Now!">
Append 'return true;' in it and it will start working.
Hi, I am also having the same problem with browse.click(); that i have to click the submit button two times. By adding "return true;" to the line - onClick="browse.click();file.value=browse.value;", it is not working.. Is there any way to make it work.