3 Replies Latest reply on Jun 17, 2013 6:05 AM by SteveMartino

    Trouble selecting field after dialog in script

    deathrobot

      Title

      Trouble selecting field after dialog in script

      Post

            

           I have several fields for entering phone numbers. Each uses a script trigger (onObjectExit) to call the following script:

            

           Set Variable [$phone ; Filter (Get (ActiveFieldContents);"0123456789")]

            

      If (

                Length ($phone) = 10;

                     "(" &  Left ($phone ; 3) & ")" & " " & Middle ($phone ; 4 ; 3) & "-" & Middle ($phone ; 7 ; 4 );

                     $phone

           )


           If (

           (Length ($phone) ≠ 10)

           and

           (not IsEmpty ($phone))

      )

            

           Show Custom Dialog ["This telephone number does not conatin 10 digits. Leave it as entered, or try again?"]

           Button 1 = "Leave it", Button 2 = "Try Again"

            

           If (

                Get ( LastMessageChoice ) = 2

                     HERE IS WHERE I'M HAVING TROUBLE!*

                Exit Script []

           )

           End If

            

      End If

            

      Exit Script []

            

      *At this step, I just need the $phone field to be active and ready for the user to retype the phone number. However, no matter what I do, the cursor just goes to whatever field is next in th tab order. I've tried Set Field by Name [$phone ; ""], Go to previous field, nothing, etc. This seems so basic. What am I missing???

            

      Thanks!