472,327 Members | 1,187 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,327 software developers and data experts.

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 3701
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Uwe Mayer | last post by:
Hi, when extending a build in class, what does the constructor __init__(...) have to return? and how does the constructor call its base-class...
1
by: Jesper Hermansen | last post by:
Hi! I'm making a system that will generate Winamp-playlists. To make it easy for the user to add a file to the list, I'm using <input...
2
by: Matt | last post by:
If I do the following, the browse text box still cannot see C:/hello world/test.txt. <input type="file" name="fileName" value="C:/hello...
2
by: Laermans_k | last post by:
Hi, Does anyone have a solution to use the <input type="file" id="filechooser"> and the <input type="submit" id="submitbutton"> in 1 button click?...
1
by: Mark Sandfox | last post by:
Is there a way to restrict the user to only selecting and sending either a ..gif or .jpg. Everything I have read says this option can not be done...
7
by: Drew Berkemeyer | last post by:
I've encounted a pretty strange problem and I'm not quite sure what to make of it. I have a web service that consumes an XML file as well as a...
7
by: pradheepayyanar | last post by:
yo yo can we validate the <INPUT TYPE="FILE">? WHILE UPLOADING A FILE I NEED TO RESTRICT THE USER FROM ENTERING TEXT DIRECTLY IN THE TEXT FIELD...
3
by: Gert | last post by:
Would it be possible to access the file CONTENT in codebehind for a standard: <input id="htmlFile" type="file" /> Then in codebehind: foreach...
1
by: ChollaPete | last post by:
This code: <form action="processScan.php" method="get"> <p> <?php print "Scan name: <input type=\"file\" name=\"tScanFileName\" value=...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.