sc_actionbar_disable("button_name")

The sc_actionbar_disable() macro disables an action bar button, preventing it from being clicked.

This macro can be used for any type of button (link or AJAX) on the action bar.


Parameter Definition

Parameter Syntax Description
button_name

Variables are not allowed. The button name must be specified using double or single quotes.

Example:
sc_actionbar_disable("ajax_btn");

This parameter is mandatory.

Specify the name of the action bar button to disable it.


Examples

Example 1: Basic macro usage

sc_actionbar_disable("link_detalhe");

Example 2: Disabling the link button to the order detail if there are no items in the order.

// Example created in the onRecord event of the Grid using the "order" and "orderdetail" tables
// If no items are in the order, the button will be disabled.

$query = "SELECT count(*) FROM OrderDetails WHERE OrderID = " . {OrderID};
sc_lookup(ds, $query);

if ({ds[0][0]} == 0) {
    // Example of using the sc_actionbar_disable macro
    sc_actionbar_disable("button_name");
} else {
    sc_actionbar_enable("button_name");
}