Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

file name text box with readonly ability

Status
Not open for further replies.

rsshetty

Programmer
Dec 16, 2003
236
US
I have the following piece of code:

<INPUT size ="50" type="FILE" name="DocImage" accept="image/*">

Sometimes the user enters his/her comments inside this field instead of clicking on a button to browse for the image. This creates an error.
I would like to make it readonly but if I do the file dialog box does not open.

Any ideas?



rsshetty.
It's always in the details.
 
If you want, you can use

onfocus="this.blur();"

to keep someone from typing anything in.

Lee
 
doesn't work :(

rsshetty.
It's always in the details.
 
I wasn't thinking when I wrote that. Sorry. The button and the textbox are all part of the input, so you can't move the focus away from one without affecting the other.

Lee
 
onkeypress="return false"

That worked. Thanks anyway.

rsshetty.
It's always in the details.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top