468,243 Members | 1,871 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,243 developers. It's quick & easy.

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

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

Apr 17 '06 #1
2 3507
Tarkeshwar wrote:
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
Apr 17 '06 #2
Tarkeshwar wrote:
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.
--
Rob
Apr 17 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Uwe Mayer | last post: by
1 post views Thread by Jesper Hermansen | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.