1 Reply Latest reply on Jul 14, 2010 7:23 AM by ralvy

    Stopping Paste in certain circumstances



      Stopping Paste in certain circumstances


      I'm finally coding my app so that users can Copy and Paste (I'm adding these back to the Edit menu for them). I'm using script triggers to prevent certain characters from being pasted. That's all fine and dandy.

      Now I see a problem that could arise. Suppose I have field that has an OnObjectModify script trigger on it, so the user sees a List View narrow its scope with each keystroke in that "search" field. Okay, now suppose they mistakenly decide to Paste text into that field. Let's say lot's of text they were unaware was in their clipboard. Well, you can imagine the problem that will arise with the OnObjectModify script trigger on that field.

      How do I prevent Paste from working in a particular field? For instance, I don't see a script step I can use to turn off Paste on ObjectEnter and turn it back on on ObjectExit.

        • 1. Re: Stopping Paste in certain circumstances

          Okay, I have a solution that seems to work for this. I remapped Ctrl-V to use a script like this, where I don't want the user to be able to paste into field1, field2, etc. :

          Set Variable [$Field; Value:Get ( ActiveFieldTableName ) & "::" & Get ( ActiveFieldName )]

          If [$Field = GetFieldName ( field1 ) or GetFieldName ( field2 ) or ...]

               Show Custom Dialog ["Paste not allowed for this field."]

               Exit Script []


               Paste [No style]

          End If

          Is there a way to get a fully resolved Active Field Name without first grabbing its Table Name and then grabbing its Field Name?