The ontabclick event is activated when a tab is clicked on a Tab Panel widget. The special variable tab can indicate the index of the tab that was clicked. The first tab is index 0, the second tab is index 1, and so on. If the JavaScript expression evaluates to false, the tab will not be switched.
Example:
The following code requires the user to fill out the information on the first tab before allowing them to switch to the second tab.
ontabclick: processTabClick(tab);
Code Block | ||||
---|---|---|---|---|
| ||||
function processTabClick(tab) {
if (tab == 1) {
if (get("FIELD1") == "" || get("FIELD2") == "") {
alert("You must fill out information on the first tab before switching to the second tab.");
return false;
}
}
return true;
}
|