Disabling one or more tabs on a multi-tab O4W Form-wizard designed form (Web)
Created at 16 MAY 2013 09:47AM
Disabling one or more tabs on a multi-tab O4W Form-wizard designed form
On a multi-tab O4W Form-wizard designed form, you might occasionally wish to programmatically disable one or more tabs (for example, certain tabs might contain information that's not appropriate or relevant for the current record). You can use the commuter module and the "tabs" plugin to achieve this.
Unfortunately, there's no call in the commuter utility to tell us "real time" what all the tabs are, so we have to hard-code which tabs you'll want to disable or enable - so this means that if you go in and add a new tab, you'll need to remember to update your commuter module logic.
So, let's say that you want to programmatically disable the second and fourth tabs. Each tab has a tab number, starting from 0, so the second and fourth tabs are really tab #1 and #3. We can put the following code into the 'post-write' event:
If bDoDisableTabs = "1" then
action = "disabled"
End Else
action = "enabled"
End
Command = '"option","':action:'",[1,3]'
* The following line invokes the 'tabs' plugin on our O4WDATATABLE section, which is the name the O4W Form Wizard uses for the section that contains the tabs
* It passes in the command line that we've just built, which is something like "option","disabled",[1,3] or "option","enabled",[1,3]
O4WPlugin("O4WDATATABLE", 'tabs', command)
The only complex bit is the line that builds the "command" string that we pass into the plugin. It reads
Singlequote doublequote option doublequote comma doublequote singlequote colon action colon singlequote doublequote comma bracket 1 comma 3 bracket singlequote
If we only need to enable or disable a single tab, then instead of putting the tab numbers inside braces, we can just pass in that single tab number, so if we just wanted to disable or enable the fourth tab (instead of both the second and fourth tabs), the Command code would look like this:
Command = '"option","':action:'",3'