To restrict "pasting" data on a text-field.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jayakrishnanav
    New Member
    • Jan 2008
    • 10

    To restrict "pasting" data on a text-field.

    Hi ,

    Is it possible to restrict "pasting" any data in a text box,through keyboard(Ctrl-p) and through mouse??Can anybody help in dis

    WarmRegards
    jk
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5388

    #2
    hi ...

    besides that is a bad idea spoken in terms of usability ... you may handle the key-events and the oncontextmenu event for this purpose ...

    kind regards

    Comment

    • jayakrishnanav
      New Member
      • Jan 2008
      • 10

      #3
      Originally posted by gits
      hi ...

      besides that is a bad idea spoken in terms of usability ... you may handle the key-events and the oncontextmenu event for this purpose ...

      kind regards
      hi,

      Actually itz a calendar field.So calendar is placed near to the textbox,so use can chose de date from it.So dere z no need for pasting any data,know?
      tatz y i askd..


      jk

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5388

        #4
        but should he be able to write it in? ... in case he shouldn't then simply set the readonly-attribute to that node ...

        kind regards

        Comment

        • jayakrishnanav
          New Member
          • Jan 2008
          • 10

          #5
          Originally posted by gits
          but should he be able to write it in? ... in case he shouldn't then simply set the readonly-attribute to that node ...

          kind regards
          no! he cant write in it!but,if the user has once entered the date through calendar and then he want to clear it..he cant delete know,if v gv readonly for tat attribute?

          Comment

          • gits
            Recognized Expert Moderator Expert
            • May 2007
            • 5388

            #6
            you could add a clear button or something like that. what does ... 'if v gv' ... mean?

            kind regards

            Comment

            • jayakrishnanav
              New Member
              • Jan 2008
              • 10

              #7
              Originally posted by gits
              you could add a clear button or something like that. what does ... 'if v gv' ... mean?

              kind regards
              ok....i mean "if we give"...sorry!!
              from now onwards wont use any short forms..:-)
              if a text field is set a disabled="true" in jsp,later
              can we clear that textfield using any function in js ?

              Comment

              • gits
                Recognized Expert Moderator Expert
                • May 2007
                • 5388

                #8
                of course .... you may set the value to an empty one:

                [CODE=javascript]text_node_ref.v alue = '';[/CODE]
                kind regards

                Comment

                Working...