JustJoker Posted November 20, 2011 Posted November 20, 2011 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
doughemi Posted November 20, 2011 Posted November 20, 2011 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.
JustJoker Posted November 20, 2011 Author Posted November 20, 2011 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
doughemi Posted November 20, 2011 Posted November 20, 2011 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.
comment Posted November 20, 2011 Posted November 20, 2011 (edited) 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, 2011 by comment
Recommended Posts
This topic is 5102 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now