November 20, 201114 yr Hello! 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!"] Beep 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. Serge
November 20, 201114 yr Is this script attached to a "Go To Some Other Layout" button? If so, If [Exit Strategy::Last Exit = "Error!"] Beep 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] .....Else ..........Go to Layout["Other Layout"] .....End If End If End If In other words, only allow the script to change the layout, not some other mechanism.
November 20, 201114 yr Author Hello, doughemi and thanks for the reply. No, the script is not attached to the button. I just tried to switch the layout by selecting it in taskbar ("Layout:" with droplist). Still does not work. Kind regards, Serge
November 20, 201114 yr There isn't any way that I know of to override layout selection from the taskbar. This is one reason why many solutions hide the taskbar and only allow users to navigate by buttons, tabs, and scripts.
November 20, 201114 yr There isn't any way that I know of to override layout selection from the taskbar. How about a script triggered OnLayoutExit? @Serge: Your question is not clear. You cannot leave the current record without committing it first - and you cannot commit a record if it doesn't pass validation (unless you choose to do so explicitly in the script). --- P.S. Please update your profile to state your version. Edited November 20, 201114 yr by comment
Create an account or sign in to comment