Validation on <input type="file">

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pradheepayyanar
    New Member
    • Jun 2006
    • 12

    Validation on <input type="file">

    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 AND SOME FILE VALIDATION HAS TO BE DONE

    help me out in handling
  • rashed
    New Member
    • Aug 2006
    • 1

    #2
    Originally posted by pradheepayyanar
    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 AND SOME FILE VALIDATION HAS TO BE DONE

    help me out in handling
    WHILE UPLOADING A FILE I NEED TO RESTRICT

    Comment

    • sashi
      Recognized Expert Top Contributor
      • Jun 2006
      • 1749

      #3
      Hi there,

      check out the below sample code segment.. take care..

      Code:
      <INPUT Disable="True" TYPE="FILE">
      set the disable attribute to true in order to restrict users from typing any text into the textbox..

      Comment

      • parv
        New Member
        • Sep 2007
        • 1

        #4
        for validating file control one should use


        onbeforeeditfoc us="return false;"

        it will work definitely



        Regards
        parv sharma
        Last edited by gits; Sep 14 '07, 09:05 AM. Reason: remove email address

        Comment

        • gits
          Recognized Expert Moderator Expert
          • May 2007
          • 5390

          #5
          Originally posted by parv
          for validating file control one should use


          onbeforeeditfoc us="return false;"

          it will work definitely



          Regards
          parv sharma
          please don't post your e-mail-address ... it is for your own security ...

          kind regards
          MOD

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            Originally posted by parv
            for validating file control one should use


            onbeforeeditfoc us="return false;"

            it will work definitely
            Welcome to TSDN!

            Unfortunately, your solution would only work in IE. A better solution is to check for key presses (onkeyup/down/press) and prevent them being registered by "return false".

            Comment

            • sakthivelpearl
              New Member
              • Dec 2007
              • 1

              #7
              Originally posted by acoder
              Welcome to TSDN!

              Unfortunately, your solution would only work in IE. A better solution is to check for key presses (onkeyup/down/press) and prevent them being registered by "return false".
              Ya it is working fine..

              Try this out...

              Comment

              • acoder
                Recognized Expert MVP
                • Nov 2006
                • 16032

                #8
                Originally posted by sakthivelpearl
                Ya it is working fine..

                Try this out...
                What's working fine?

                Comment

                Working...