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

Discussion in 'Javascript' started by Tarkeshwar, Apr 17, 2006.

  1. Tarkeshwar

    Tarkeshwar Guest

    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">
    Tarkeshwar, Apr 17, 2006
    #1
    1. Advertising

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


    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
    Janwillem Borleffs, Apr 17, 2006
    #2
    1. Advertising

  3. Tarkeshwar

    RobG Guest

    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
    RobG, Apr 17, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jaydeep
    Replies:
    3
    Views:
    1,038
    vedcyrus
    Jun 30, 2006
  2. Chishun Kwong
    Replies:
    0
    Views:
    407
    Chishun Kwong
    Mar 3, 2005
  3. jonesy
    Replies:
    0
    Views:
    533
    jonesy
    Oct 26, 2006
  4. Baiju K U

    Restrict the file type for uploading

    Baiju K U, Feb 9, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    98
    Baiju K U
    Feb 9, 2004
  5. Restrict user input

    , Jan 18, 2006, in forum: Javascript
    Replies:
    10
    Views:
    233
    Randy Webb
    Jan 20, 2006
Loading...

Share This Page