User interface
Learn how to show messages and navigate users with Ninox scripts.
User interface and navigation functions shape what users see and where they go next. This chapter shows you how to guide users and navigate your app.
alert()
Show a simple message
closeAllRecords()
Close all open record views
closeFullscreen()
Exit full screen mode
closeRecord()
Close the current record view
dialog()
Show a dialog with answer options
openFullscreen()
Open a record in full screen
openPage()
Open a page
openPrintLayout()
Open a record in a print layout
openRecord()
Open a record in its table
openTable()
Open a table
popupRecord()
Open a record in a pop-up
Show messages and call up records
Use these functions when you want to guide users with a message or show record details without changing the main view.
Show a simple message with alert()
Use alert() to show a pop-up with a message and an OK button.
Use it when you want to:
Confirm a successful action.
Warn about missing input.
Show information the user should acknowledge before continuing.
alert(any)
anythe value or message to show
alert() returns no value.
Let's take a look at some examples:
Shows a pop-up with an OK button.
Shows the current time when the pop-up opens.
Tips:
Keep messages short.
alert()runs only on the client.If one script calls
alert()several times, only the last call is shown.Use
dialog()when users need a choice, not just confirmation.
Ask for confirmation with dialog()
Use dialog() to show a dialog with a title, message, and answer options.
Use it when you want to:
Ask users to confirm a decision.
Let users choose between clear answers such as
YesandNo.
dialog(string, string, [string])
first
stringthe dialog titlesecond
stringthe dialog messagethird
[string]the answer options to show
dialog() returns the selected answer as a string.
The script waits until the user picks an answer.
Let's take a look at some examples:
Opens a confirmation dialog for a delete action.
Deletes the current record only if the user confirms.
The user is asked to double-check the questionable input.
Tips:
dialog()runs only on the client.Store the result in a variable when later steps depend on the answer.
Open pages, tables, records, and layouts
Use these functions to move users to the next relevant place in the app. Display records from other tables without leaving the current view or jump directly to a print layout.
Open a page with openPage()
Use openPage() to call up a page by name.
Use it when you want to:
Guide users through your app with buttons and triggers.
openPage(string)
stringthe page Label or Internal name as text
openPage() closes the current page, form, or table and opens the selected page.
Let's take a look at some examples:
Opens the page named "Dashboard".
Opens the page with the internal name "invoices_overview".
If you change a page's Label or Internal name, update the string in this function too. Ninox cannot update it automatically.
Tip:
If the page has tabs, Ninox opens the first tab.
Open a table with openTable()
Use openTable() to open a table by name.
Use it when you want to:
Route users through your app with buttons and triggers.
openTable(string)
stringthe table Label or Internal name
openTable() closes the current table or page and opens the selected table.
Let's take a look at an example:
Opens the "Invoices" table.
If you change a table's Label or Internal name, also update the string in this function. Ninox cannot update the string automatically.
Tip:
Ninox opens the first view of the table.
Open a record with openRecord()
Use openRecord() to open a record directly.
Use it when you want to:
Route users through your app with buttons and triggers.
Open a specific record to work with it.
openRecord(nid)
nidthe record you want to open
openRecord() closes the current form. If the target record is in another table, it also closes the current table. It then opens the target record's table and form view.
Let's take a look at some examples:
Opens the record with the ID 1 in the "Settings" table.
Opens the "Customers" table and the first record whose "Name" field is "John Doe".
Tips:
openRecord()runs only on the client.Use
popupRecord()instead when a quick preview is enough and users should stay in the current table.
Call up a record with popupRecord()
Use popupRecord() to show a record in a pop-up.
Use it when you want to:
Open and work on a specific record briefly without leaving your workflow.
popupRecord(nid)
nidthe record you want to preview
Let's take a look at some examples:
Opens the record with ID 1 from the "Settings" table in a pop-up form.
Opens the first "Customers" record whose "Name" field is "Jane Roe" in a pop-up form.
Tips:
popupRecord()runs only on the client.Use
record()instead ofselectto retrieve a record. It is much faster for large tables.
Open a print layout with openPrintLayout()
Use openPrintLayout() to open a specific print layout for a record.
Use it when you want to:
Open a specific print layout for a specified record.
openPrintLayout(nid, string)
nidrecord you want to show in the print layoutstringprint layout name
Let’s take a look at some examples:
Opens the print layout "Invoice" for the current record.
Finds the first record in the "Invoices" table with the "Status" field set to "Approved". It then opens the record in the "Invoice pdf" print layout.
Change the current view
Use these functions when you want to switch display modes or clean up open record windows.
Enter or leave full screen with openFullscreen() and closeFullscreen()
Use these functions to open a record in its form view in full screen or exit full screen mode.
openFullscreen(nid)
closeFullscreen()
nidthe record you want to open in full screen
Let’s take a look at some examples:
Opens the current record in full screen.
Exits full screen mode and returns to the previous view.
Tip:
openFullscreen()covers the entire window with the form view.
Use closeRecord() and closeAllRecords() to close open form views
Use these functions when you want to:
Return users to the underlying page or table.
Close several stacked form views quickly.
closeRecord()
closeAllRecords()
Let's take a look at some examples:
Closes the current record view. Users then see the form below it, or the current table view if no other form is open.
Closes all open record views and returns users to the current table view.
Tips:
Close only what you need.
Avoid combining several open and close actions in one script unless the flow is obvious.
Common UI and navigation recipes
These short patterns cover common ways to guide users through an app.
Show short success feedback
Shows immediate feedback after a successful action.
Ask for delete confirmation
Prompts the user before a destructive action.
Stay in your workflow while creating new records
Create records in another table without leaving your current workflow. Use a button to create the record, then open it in a pop-up form to add more data.
Last updated
Was this helpful?