6 Replies Latest reply on Nov 20, 2011 9:11 PM by justjoker

    Stop layout switch in a script?



      Stop layout switch in a script?



      I'm new in scripting but trying to stop current layout from the switch to other one by the script that:

      1. Verifies 2 arguments Exit 1 and Exit 2 (the sum must be less or equal then 100).
      2. If 2 fields are <= 100, the user should not be able to exit the layout and be returned to the original one (selected field).

      I've wrote the script:

      If [Exit Strategy::Last Exit = "Error!"]
      Show Custom Dialog ["Error!"; "The sum must be <= 100"; Exit strategy::Exit 1; Exit Stratagy::Exit 2]
      If [Get (LastMessageChoice) = 1]
      If [Exit Strategy::Exit 1 + Exit strategy::Exit 2 <= 100]
      Go to Layout ["Exit Strategy)]
      Go to Field [Exit strategy::Exit 1]
      End If
      End If
      End If

      When I verify the sum of Exit 1 and Exit 2 fields within the layout it's OK. But when I switch to other layouts, I can't force the script to stay in current layout till the sum of the fields is validated.

      I'm sure I miss something.

      Help please.