Skip to content

Menu & Dialog Functions Documentation

This guide covers how to use show_menu, show_alert, show_processing, and show_toast in both HTML and JavaScript.


Opens a custom menu/dialog box. Menus can slide from bottom, top, or appear as modals.

show_menu(
name, // Menu ID (required)
reset = false, // Reset all elements in menu (optional)
locked = false, // Lock menu (prevent closing) (optional)
outside_click = {...}, // Action on outside click (optional)
button_click = [...] // Actions for buttons (optional)
);
// Open menu without resetting
show_menu("menu_my_menu", false, false);
// Open menu and reset all elements
show_menu("menu_my_menu", true, false);
// Open locked menu (cannot be closed)
show_menu("menu_my_menu", false, true);
// Custom outside click action
show_menu("menu_my_menu", false, false, { operation: "function", function_name: "myFunction" }, [
{ operation: "close" },
{ operation: "function", function_name: "saveData" },
{ operation: "close" },
]);
<div
id="menu_my_menu"
class="menu menu-box-bottom menu-box-detached rounded-m"
data-menu-effect="menu-over"
>
<div class="menu-title mt-n1">
<h1>Menu Title</h1>
<a href="#" class="close-menu"><i class="fa fa-times"></i></a>
</div>
<div class="divider mt-0 mb-0"></div>
<div class="content">
<!-- Your menu content here -->
</div>
</div>
<div
id="menu_my_modal"
class="menu menu-box-modal menu-box-detached rounded-m"
data-menu-effect="menu-over"
>
<div class="content">
<!-- Your modal content here -->
</div>
</div>
<div
id="menu_my_menu"
class="menu menu-box-top menu-box-detached rounded-m"
data-menu-effect="menu-over"
>
<div class="content">
<!-- Your menu content here -->
</div>
</div>

Method 1: Using close-menu class (Automatic)

<!-- Simple close button - automatically closes menu -->
<a href="#" class="close-menu">
<i class="fa fa-times"></i>
</a>
<!-- Close button with app-nursery-click class -->
<a href="#" class="close-menu app-nursery-click">
<i class="fa fa-times"></i>
</a>

Method 2: Using data-click attribute (Explicit)

<!-- Close menu without reset -->
<a
href="#"
data-click='{"operation": "hide_menu", "reset": false, "open_last": false}'
class="btn btn-full bg-grass-dark"
>
Close
</a>
<!-- Close menu and open last closed menu -->
<a
href="#"
data-click='{"operation": "hide_menu", "reset": false, "open_last": true}'
class="btn btn-full"
>
Back
</a>
<!-- Close menu and reset it -->
<a
href="#"
data-click='{"operation": "hide_menu", "reset": true, "open_last": false}'
class="btn btn-full"
>
Cancel
</a>

Method 3: In Menu Title (Common Pattern)

<div class="menu-title mt-n1">
<h1>Menu Title</h1>
<a href="#" class="close-menu app-nursery-click">
<i class="fa fa-times"></i>
</a>
</div>
ParameterTypeDefaultDescription
namestringrequiredID of the menu element
resetbooleanfalseIf true, resets all inputs/dropdowns in menu
lockedfalsefalseIf true, menu cannot be closed by user
outside_clickobject{operation: "close"}Action when clicking outside menu
button_clickarray[{operation: "close"}, ...]Actions for 3 buttons

Shows an alert dialog with customizable header, text, icon, colors, and buttons.

show_alert(
header = "Error", // Alert title
text = "Something has gone wrong", // Alert message
icon = ["fas", "fa-exclamation-triangle"], // Icon classes
colour = ["red", "dark"], // Color scheme
locked = false, // Lock alert
language = true, // Translate text
outside_click = { operation: "close" }, // Outside click action
button_click = [{ operation: "close" }, ...], // Button actions
button_display = [ // Button configuration
{ visible: true, caption: "Understood", button_type: 1, button_colour: ["grass", "dark"] },
{ visible: false },
{ visible: false }
]
);
show_alert("Error", "Something went wrong", ["fas", "fa-exclamation-triangle"], ["red", "dark"]);
show_alert(
"Success",
"Data saved successfully",
["fas", "fa-check-circle"],
["grass", "dark"],
false,
true,
{ operation: "close" },
[{ operation: "function", function_name: "refreshPage" }],
[
{ visible: true, caption: "OK", button_type: 1, button_colour: ["grass", "dark"] },
{ visible: false },
{ visible: false },
]
);
show_alert(
"Confirm",
"Are you sure you want to delete?",
["fas", "fa-question-circle"],
["orange", "dark"],
false,
true,
{ operation: "close" },
[
{ operation: "close" },
{ operation: "function", function_name: "deleteItem" },
{ operation: "close" },
],
[
{ visible: true, caption: "Cancel", button_type: 2, button_colour: ["red", "dark"] },
{ visible: true, caption: "Delete", button_type: 1, button_colour: ["red", "dark"] },
{ visible: false },
]
);
show_alert(
"Processing",
"Please wait, do not close this window",
["fas", "fa-spinner"],
["blue", "dark"],
true // Locked - user cannot close
);
  • Type 1: Filled button (bg-{color}-{tone})
  • Type 2: Outlined button (color-{color}-{tone} border-{color}-{tone})
  • red, green, blue, orange, grass, yellow, etc.
  • Tones: light, dark
// Close alert
hide_alert();
// Close and open last closed menu
hide_alert(true);

Alerts can be closed using the same methods as menus:

Method 1: Using close-menu class

<a href="#" class="close-menu">
<i class="fa fa-times"></i>
</a>

Method 2: Using data-click attribute

<a
href="#"
data-click='{"operation": "hide_menu", "reset": false, "open_last": false}'
class="btn btn-full"
>
Close
</a>

Note: Alert buttons are configured in the button_click parameter when calling show_alert(). The framework automatically handles button clicks based on this configuration.

The alert menu is a system menu with ID system_menu_alert. It’s already defined in the framework, so you don’t need to create it in HTML.


Shows a loading/processing dialog. Automatically locked (cannot be closed).

show_processing(
(header = "Processing"), // Header text
(text = "Please Wait"), // Message text
(language = true) // Translate text
);
show_processing();
// Shows: "Processing" / "Please Wait"
show_processing("Uploading Files", "Please wait while we upload your files", true);
show_processing("Processing Request", "Please Wait", false);
// Close processing dialog
hide_processing();
// Close and open last closed menu
hide_processing(true);

Processing dialogs are automatically locked (cannot be closed by user). They should only be closed programmatically using hide_processing() after the operation completes.

Note: Processing dialogs cannot be closed via HTML buttons as they are locked by default.

// Show processing before API call
show_processing("Loading Data", "Please Wait", true);
// Make API call
load_report(
"endpoint",
{
/* params */
},
function success(response) {
hide_processing();
// Handle success
},
function error(response) {
hide_processing();
show_alert("Error", "Failed to load data");
}
);

The processing menu is a system menu with ID system_menu_processing. It’s already defined in the framework.


Shows a toast notification (snackbar) that auto-dismisses.

show_toast(
(text = "Something has gone wrong"), // Toast message
(icon = ["fas", "fa-exclamation-circle"]), // Icon classes
(colour = ["grass", "dark"]), // Background color
(language = true) // Translate text
);
show_toast("Data saved successfully", ["fas", "fa-check-circle"], ["grass", "dark"], true);
show_toast("Failed to save data", ["fas", "fa-times-circle"], ["red", "dark"], true);
show_toast("Please check your input", ["fas", "fa-exclamation-circle"], ["orange", "dark"], true);
show_toast("New message received", ["fas", "fa-info-circle"], ["blue", "dark"], true);
  • ["fas", "fa-check-circle"] - Success
  • ["fas", "fa-times-circle"] - Error
  • ["fas", "fa-exclamation-circle"] - Warning
  • ["fas", "fa-info-circle"] - Info
  • ["fas", "fa-spinner"] - Loading

The toast menu is a system menu with ID menu_toast. It’s already defined in the framework.


function submitForm() {
// Show processing
show_processing("Submitting", "Please wait...", true);
// Submit data
load_report(
"submit_form",
{
/* form data */
},
function success(response) {
hide_processing();
show_alert(
"Success",
"Form submitted successfully",
["fas", "fa-check-circle"],
["grass", "dark"]
);
},
function error(response) {
hide_processing();
show_alert(
"Error",
response.error_details,
["fas", "fa-exclamation-triangle"],
["red", "dark"]
);
}
);
}
function confirmDelete(itemId) {
show_alert(
"Delete Item",
"Are you sure you want to delete this item?",
["fas", "fa-trash"],
["red", "dark"],
false,
true,
{ operation: "close" },
[
{ operation: "close" },
{ operation: "function", function_name: "deleteItem", parameters: itemId },
{ operation: "close" },
],
[
{ visible: true, caption: "Cancel", button_type: 2, button_colour: ["red", "dark"] },
{ visible: true, caption: "Delete", button_type: 1, button_colour: ["red", "dark"] },
{ visible: false },
]
);
}
function deleteItem(itemId) {
hide_alert();
show_processing("Deleting", "Please wait...", true);
// Delete API call
load_report(
"delete_item",
{ id: itemId },
function success() {
hide_processing();
show_toast("Item deleted successfully", ["fas", "fa-check-circle"], ["grass", "dark"], true);
},
function error() {
hide_processing();
show_alert("Error", "Failed to delete item", ["fas", "fa-times"], ["red", "dark"]);
}
);
}

Example 3: Opening Custom Menu from Button

Section titled “Example 3: Opening Custom Menu from Button”

HTML:

<button
id="button_open_settings"
data-click='{"operation": "function", "function_name": "openSettings"}'
class="btn btn-full bg-grass-dark"
>
Open Settings
</button>
<div id="menu_settings" class="menu menu-box-bottom menu-box-detached rounded-m">
<div class="menu-title mt-n1">
<h1>Settings</h1>
<a href="#" class="close-menu"><i class="fa fa-times"></i></a>
</div>
<div class="divider mt-0 mb-0"></div>
<div class="content">
<!-- Settings content -->
</div>
</div>

JavaScript:

function openSettings() {
show_menu("menu_settings", true, false);
}

// Menu
show_menu(name, reset, locked, outside_click, button_click);
hide_menu(open_last, reset);
// Alert
show_alert(
header,
text,
icon,
colour,
locked,
language,
outside_click,
button_click,
button_display
);
hide_alert(open_last);
// Processing
show_processing(header, text, language);
hide_processing(open_last);
// Toast
show_toast(text, icon, colour, language);
Use CaseFunctionExample
Show loadingshow_processing()Before API call
Show successshow_toast() or show_alert()After successful operation
Show errorshow_alert()On error
Confirm actionshow_alert() with 2 buttonsBefore delete
Custom dialogshow_menu()Custom menu/dialog

  1. System Menus: show_alert(), show_processing(), and show_toast() use predefined system menus. You don’t need to create them in HTML.

  2. Custom Menus: For show_menu(), you need to create the menu element in HTML with the appropriate classes.

  3. Translation: Set language = true to automatically translate text using the framework’s translation system.

  4. Locked Menus: Use locked = true to prevent users from closing dialogs (useful for processing).

  5. Button Actions: Button actions can be:

    • { operation: "close" } - Close menu
    • { operation: "function", function_name: "myFunction" } - Call function
    • { operation: "link", page_name: "page.html" } - Navigate to page
  6. Menu Types:

    • .menu-box-bottom - Slides from bottom
    • .menu-box-top - Slides from top
    • .menu-box-modal - Centered modal
    • .menu-box-left - Slides from left
    • .menu-box-right - Slides from right