4 Replies Latest reply on Jun 9, 2010 5:58 PM by Radcon

    Can't lock a radio button field

    Radcon

      Title

      Can't lock a radio button field

      Post

      I have a field formated as a radio buttons that the user chooses one of two options for a conditional value list.  In all the other fields, I have been able to show a friendly dialog that indicates the field is locked by either an OnLayoutKeystroke, or an OnObjectEnter(for drop down lists & calendars) script trigger.  Clicking in the radio button field gives me the locked record dialog, but changes are made anyway.  I would have thought the OnObjectEnter trigger would have fired before any changes were allowed.  How can I prevent changes to this field?  There is an OnObjectModify trigger in the same field that sends the user to the secondary value list when changes are made in an unlocked condition.

       

      Thanks in advance for any suggestions!

       

      FMPA 10; XP Professional

        • 1. Re: Can't lock a radio button field
          mmccarty

          OnObjectEnter is a "post" script trigger, meaning it will execute after the event has been processed.  You want a "Pre" script trigger maybe try OnObjectCommit.  The user will be able to change the field but before the change is committed it the script trigger will fire.  The attached script can then revert the record if the field is suppose to be locked.

           

          Another idea,  if the field is locked for all records then change the field behavior so that it can't be entered in Browse mode.  Add a tool tip that tells the user the field is locked.

          • 2. Re: Can't lock a radio button field
            ninja

            Another option if no apropriate pre-event script trigger is found would be to go back to the pre-trigger days...

             

            Make the radio button selections buttons which fires scripts of the type:

             

            If [Lockfield = "Unlocked"]

                 SetField [RadioField ; "Desired value"]

            EndIf

             

            • 3. Re: Can't lock a radio button field
              raybaudi

              Radcon wrote:

               

              How can I prevent changes to this field? 


              You CAN use the OnObjectEnter trigger, passing as Script Parameter the field's value.

               

              The script will be something like this:

               

              Set Field [  YourField ; Get ( ScriptParameter  )  ]
              Commit Records/Requests [  ]

               


              • 4. Re: Can't lock a radio button field
                Radcon

                Contributors, I apolize for taking up your time.  The problem is a recurring Trim(ID 10 T) error.   My record lock function works just fine when I am logged in with the correct privilege set on any style field.  I thought I was having this problem while logged in with [full access]. 

                I am still having trouble consistenly intercepting the unfriendly messages with my "Click the padlock to unlock the record" dialog.  My interceptor script works fine for edit fields, but not for drop down lists, radio buttons, calendars, and such. 

                The OnRecordCommit trigger will not let me relock when desired changes are made because I have to modify data on the record to set the lock flag.   Thanks for your suggestions!

                 

                If [ Let (
                key= Code (Get(TriggerKeystroke));
                key=9 or key=10 or key=28 or key=29 or key=30 or key=31) ]
                #do nothing; certian keystrokes are allowed
                Else If [ Items::Lock=0 ]
                Show Custom Dialog [ Title: "Record is locked"; Message: "Click on the lock below to make changes"; Buttons: “OK” ]
                Exit Script [ Result: 0 ]
                End If
                #