By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,426 Members | 1,689 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,426 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.