how to restrict user from input in <input type="file">

T

Tarkeshwar

Hi All,
I want to restrict the user from being entering the value in
<input type="file">. It works fine in IE but not in Mozilla. I am
sending my code also which works in IE and not in Mozilla.Can anybody
have the solution.

Thanks in advance.


code :

<input type="file" name="theFile" ContentEditable="false" size="40">
 
J

Janwillem Borleffs

Tarkeshwar said:
Hi All,
I want to restrict the user from being entering the value in
<input type="file">. It works fine in IE but not in Mozilla. I am
sending my code also which works in IE and not in Mozilla.Can anybody
have the solution.

You could it with <input type="file" onkeypress="return false" />, but
what's the use? It only annoys users when features like this are blocked...


JW
 
R

RobG

Tarkeshwar said:
Hi All,
I want to restrict the user from being entering the value in
<input type="file">. It works fine in IE but not in Mozilla. I am
sending my code also which works in IE and not in Mozilla.Can anybody
have the solution.

There isn't one. You can disable the element, but then the user can't
use it at all. You can try 'readonly' but that is only supposed to work
with type text or password, results may vary.

code :

<input type="file" name="theFile" ContentEditable="false" size="40">

contenteditable is a Microsoft proprietary attribute, it is not part of
HTML 4. It is not supposed to be available for input type=file, only for:

"...INPUT type=button, INPUT type=password, INPUT type=radio,
INPUT type=reset, INPUT type=submit, INPUT type=text..."

<URL:http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/contentEditable.asp>

The fact that it 'works' means that there is either a bug in IE or the
MSDN documentation is wrong.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top