LogoLogo
What's NewDeveloper CommunitySupportStatus
  • 🚀Get Started
    • What is JourneyApps Platform?
    • Tutorial: Build your First App
      • 1. Introduction
      • 2. Create a new App
      • 3. OXIDE IDE Overview
      • 4. Hello World app
      • 5. The Data Model
      • 6. View Components
      • 7. Queries and Data Sync
      • 8. Simple Navigation
      • 9. View Stack
      • 10. Input Validation
      • 11. View Parameters
      • 12. Data Manipulation
      • 13. Responsive Apps
      • 14. Styling
      • 15. Lists
      • 16. GPS Capturing
      • 17. Relationships
      • 18. Multiple User Roles
      • 19. Deployment and Users
      • 20. Version Control
      • 21. CSV and APIs
      • 22. Conclusion
    • JourneyApps Platform Fundamentals
      • Creating a New App
        • Git-enabled Apps
      • What are Views?
      • What is the Data Model?
      • JourneyApps Syntax Basics
      • Access the Database (DB)
        • Manipulate DB Objects
        • Query DB Objects
      • View Navigation
        • Deep Linking
      • CloudCode Overview
      • OXIDE (Online IDE)
  • 💻Build your App
    • JourneyApps Syntax
      • Syntax Basics
      • Access the DB
      • View Navigation
      • Async & Await
      • TypeScript Apps (Beta)
        • runtime-build package
        • TypeScript App Troubleshooting
      • What's New in V4
        • Updating to the V4 API
    • Configure your Data Model
      • What is the data model?
      • Reference: model
        • field
        • belongs-to
        • has-many
        • index
      • Data Rules
        • Data Buckets
        • Sync Rules - Limit data synced to devices
        • Data ACLs - Limit access to data
        • Real-world example for Data Rules
        • ❔FAQs
        • Migrate to Data Rules
      • App Indexes
      • Webhooks
    • UI Components
      • All UI Components
        • actionSheet
        • Attachments
        • button
        • button-group
        • capture-coordinates
          • marker
          • marker-query
        • capture-file
        • capture-photo
        • capture-signature
        • card
          • accent
          • action
        • columns
          • column
        • component
        • context-menu
          • divider
          • item
        • CSV
        • date-input
        • datetime-input
        • dialog
          • body
        • display-3d-model
          • 📖display-3d-model Guides
            • Guide 1: Initialize and layout a 3D model in a view
            • Guide 2: Control playback position
            • Guide 3: Troubleshooting controls
        • display-coordinates
        • display-file
        • display-image
        • display-photo
        • display-signature
        • heading
        • html
          • HTML Advanced Topics
          • ❔HTML FAQs
          • 📖Guide: HTML & JourneyApps iFrame Client
        • icons
        • info
        • info-table
          • row
        • journey.photos (capture multiple photos)
        • JourneyPrinter (print PDFs)
        • grid
          • cell
          • 📖grid Examples
        • list
          • list-item
            • accent
            • asset
            • pills
              • pill
            • action
        • multiple-choice-checklist
        • navigation (Navigation drawer)
          • general-section
            • item
          • section
            • item
              • item
          • ❔navigation FAQs
        • notification
        • object-dropdown
        • object-list
          • action
        • object-repeat
        • object-table
          • action
          • column
            • action
            • edit-boolean
            • edit-date
            • edit-datetime
            • edit-integer
            • edit-number
            • edit-select
            • edit-text
            • edit-time
            • edit-typeahead
              • action
            • header-action
          • column-group
          • empty-action
          • 📖object-table Guides
            • Actions
            • Cell callouts
            • Column groups
            • Columns
            • Controlled object-table
            • Controls
            • Copy & paste data
            • Edit cells
            • Filters
            • Frozen columns
            • Fullscreen object-table
            • Mode
            • State
            • Styles
        • optionList
        • PhotonSync (transfer data offline)
        • power-bi
          • 📖Guide: PowerBI Embedding
        • scan-barcode
        • shortcut
        • sidebar
        • single-choice-dropdown
        • single-choice-radio
        • template
        • text-input
        • time-input
        • toggle
        • view
      • JS/TS Events
      • Show / Hide UI Components
      • View Templates
      • XML Fields (Attributes)
        • align-content
        • align-controls
        • align-label
        • bind
        • clear-button-visibility
        • control-order
        • disabled
        • error-message
        • icon-position
        • id
        • hide-if
        • modifier-text
        • label
        • label-case
        • label-color
        • on-change
        • on-press
        • placeholder
        • required
        • show-if
    • JS / TS APIs
      • Attachment
      • Bluetooth (Beta)
      • Broadcast
      • component
      • CSV
      • DB
      • HardwareBarcode
      • journey
        • journey.config
        • journey.container
        • journey.device
        • journey.diagnostics
        • journey.dialog
        • journey.files
        • journey.hardware
        • journey.photos
        • journey.runtime
        • journey.sensors
        • journey.viewStack
      • JourneyPrinter
      • KeyboardBarcode
      • LocalDB
      • NFC
      • OnlineDB
      • PhotonSync
      • SerialPort
      • ShortcutManager
      • TCPSocket
      • user
    • Extend your App with Custom Code
      • App packages
        • App packages overview
        • PDF report package
        • TypeScript library & unit tests
        • Manage External Dependencies
      • Custom HTML
    • Style & Customize your App
      • Style & configure UI components
        • Overview
        • Understand extendable themes
        • Use themes on a view
        • Theme specific components on a view
        • Examples
        • Debugging
        • ❔FAQs
      • Change your App Font
      • Custom Branding
        • Custom Container Features
        • Special Requirements for iOS Containers
    • Integrate your App
      • Backend integrations with CloudCode
      • Barcode Scanning
        • Barcode Scanning using Keyboard Emulation
        • Hardware Barcode Scanning
        • scan-barcode
      • Bluetooth Low Energy (BLE)
      • Broadcast API
      • HTTP requests (Fetch API)
      • JourneyApps Print (Android)
      • Maps and navigation
      • NFC
      • Opening external links/apps
      • Serial Port
      • TCP Sockets
    • Design Intuitive Apps
      • UX Guidelines
      • Write Effective Copy
  • 📱App Features
    • RealWear® Voice Control
      • Automatic Voice Commands
        • Automatic Voice Commands - Advanced
      • Manual Voice Commands
    • App, Runtime and Container Updates
    • Batch Operations (App)
    • Call JS/TS Functions from XML
    • Capture GPS Locations
    • Push Notifications
    • Translations
    • XML Format Strings
    • Webhooks (External)
  • 🌐CloudCode
    • CloudCode Overview
    • Trigger a CloudCode Task
      • Trigger CC with a Schedule
      • Trigger CC via a Webhook
      • Trigger CC from an App
      • Trigger CC from Another Task
      • Trigger CC via HTTP
    • Attachments in CloudCode
    • Timezones
    • Advanced CloudCode Topics
      • Access Multiple DBs in CloudCode Tasks
      • Batch API (CloudCode)
      • CloudCode Dependencies
      • Configure HTTPS in CloudCode
      • Deployment environment variables
      • Local CloudCode Development
      • PDF Reports using CloudCode
      • Shared CloudCode Tasks
      • Translations in CloudCode
  • 📥Backend API
    • Introduction
    • API Reference
      • Retrieve All Objects
      • Query Objects
      • Sort Results
      • Limit and Skip
      • Count Objects
      • Create a New Object
      • Retrieve a Single Object
      • Update a Single Object
      • Delete a Single Object
      • Batch Operations (v4 API)
      • Oplog API
      • Retrieve the App Data Model
      • Manage App Users and Sessions
      • Field Representation
      • Error Responses
    • API Limits
    • Update to the V4 API
  • ⚙️Technical
    • Data Synchronization Priority
    • Device Diagnostics
    • JSON1 Query Engine
    • Improve App Performance
    • Security Measures
    • Supported Platforms
      • Web Container
      • Windows Installer
    • Domain Whitelist
  • 🖥️OXIDE
    • Get started with OXIDE
      • OXIDE Overview
      • Components of OXIDE
    • Configure Testing Deployments
    • Edit and Manage Files
      • How to Navigate to a Function
      • Manage External Dependencies
    • Create and Manage App Containers
    • Debugging & Troubleshooting
      • Common Troubleshooting Pointers
      • App Diagnostics Reports
      • Build Logs
    • OXIDE Workspaces
      • OXIDE Trees
  • ❕Deprecated Features
    • Deprecated Features and Components
Powered by GitBook
On this page
  • Overview
  • dialog use cases
  • Standard Attributes
  • id
  • title
  • Advanced Attributes
  • auto-hide
  • on-cancel
  • on-submit
  • submit-text and cancel-text
  • subtext
  • Component Methods
  • scrollIntoView
  1. Build your App
  2. UI Components
  3. All UI Components

dialog

Previousdatetime-inputNextbody

Last updated 2 years ago

Overview

The dialog UI component appears as a blocking overlay that provides information or confirms destructive behavior. They often prompt users to make a decision.

Version compatibility

dialog was introduced in version 4.58.0 of the JourneyApps Runtime.

This dialog component is generated from the view's XML. For dialogs triggered from JavaScript/TypeScript, see .

Known limitation

A dialog can currently not be shown upon entering a view (e.g. by calling it from the init() or resume() function).

dialog use cases

There are 3 main use cases for dialog. These are described in more detail below.

  1. dialogs

  2. dialogs

  3. dialogs

Simple

A simple dialog displays information to the user and does not require the user to make a decision, thus can be dismissed by selecting the primary button, hitting the Esc key or back button.

Tip

Use simple dialogs sparingly as they are interruptive. Rather, less obtrusive can be used.

Example

main.view.xml
<dialog id="success-dialog" title="Success" subtext="You have been successfully enrolled."/>
main.js
function onEnrollment() {
    component.dialog({id: "success-dialog"}).show();
}

Confirmation

A confirmation dialog gives the user the ability to provide final confirmation of a decision before committing to it. If the user confirms a choice, it’s carried out. Otherwise, the user can dismiss the dialog by selecting the secondary button.

Example

main.view.xml
<dialog id="reset-settings" title="Reset settings?" submit-text="Reset"
        subtext="Would you like to reset your app to its default settings"
        on-submit="$:resetSettings(true)" on-cancel="$:resetSettings(false)"/>
main.js
function showResetSettings() {
    component.dialog({id: "reset-settings"}).show();
}

function resetSettings(ok){
    if (ok) {
        // Logic here
    } else {
        // Other logic here
    }
}

Composition

A composition dialogs allows developers to embed other UI components inside it, therefore offering a wide range of input options.

To embed a UI component to the dialog, add it inside a body tag. Refer to the syntax for more detail.

Example:

main.view.xml
<!-- XML -->
<dialog id="dialog-input" title="Stock: {$:getStockTitle()}">
    <body>
        <text-input label="Capture stock Qty" bind="stock" required="true" />
    </body>
    <button-group>
        <button label="Cancel" color="negative" on-press="$:onCancel()" validate="false"/>
        <button label="Save" on-press="$:onSubmit()" validate="true"/>
    </button-group>
</dialog>
main.js
// JS
function getStockTitle(){
    return view.cur_item.name;
}

function onCancel() {
    // Logic for when the user selects Cancel
}

function onSubmit() {
    // Logic for when the user selects Save
}

Standard Attributes

id

Required

<dialog id="task-complete" title="Task complete" />

The id attribute is required to target a particular dialog to call show() or hide() on it.

<dialog id="task-complete" title="Task complete"/>
function onTaskComplete() {
    component.dialog({id: "task-complete"}).show();
}

function onTaskUploadFail() {
    component.dialog({id: "task-complete"}).hide();
}

See also:

title

Optional

Default: unset

<dialog id="login-dialog" title="Login successful"/>

A dialog's title communicates its purpose to the user.

Titles should:

  • Contain a brief, clear statement or question

  • Summarize the dialog's content

  • Avoid the following:

    • apologies (“Sorry for the interruption”)

    • alarm (“Warning!”)

    • ambiguity (“Are you sure?”)

<dialog id="task-complete" title="Task complete" />
function onTaskComplete() {
    component.dialog({id: "task-complete"}).show();
}

Advanced Attributes

auto-hide

Optional

Type: boolean

Default: true

<dialog id="discard-dialog" title="Unsaved changes"
subtext="You have unsaved changes, are you sure you want to discard?" auto-hide="false" >

By default the dialog will automatically hide when the user selects any of its buttons. To override this behavior, specify auto-hide="false".

When specifying auto-hide="false", you are responsible for hiding the dialog using component.dialog({id:'myId'}).hide().

<dialog id="tc-dialog" title="Terms and conditions" subtext="Do you agree to these Ts and Cs?"
        auto-hide="false"
        on-submit="$:agree(true)" on-cancel="$:agree(false)"
        submit-text="Agree" cancel-text="Disagree">
function showTsAndCs() {
    component.dialog({id: "tc-dialog"}).show();
}

function agree(predicate){
    if (predicate){
        component.dialog({id: "tc-dialog"}).hide();
        // Other success logic here
    } else {
        var ok = confirmDialog('By not agreeing to these terms, you void your warranty.\n
                                Are you sure?');
        if (ok) {
            component.dialog({id: "tc-dialog"}).hide();
            // Other logic here
        }
        // The dialog will not hide and the user may change their selection
    }
}

on-cancel

Optional

Default: unset

Triggered when: The secondary button on a confirmation dialog is selected.

Event parameter: Empty by default. Can be a user-defined variable or field.

Return value: undefined, or the user-defined variable or field

main.view.xml
<dialog id="use-location" title="Use location Service?" subtext="The app requires access to your location"
        on-submit="$:useLocation(true)" on-cancel="$:useLocation(false)"/>
main.js
function askLocation() {
    component.dialog({id: "use-location"}).show();
}

function useLocation(ok){
    if (ok) {
        // Logic for on-submit here
    } else {
        // Logic for on-cancel here
    }
}

Specifying on-cancel will change the dialog to a confirmation dialog, with a secondary and primary button.

on-submit

Optional

Default: unset

Triggered when: The primary button (for simple dialogs) or submit button (for multi-button dialogs) on a dialog is selected.

Event parameter: Empty by default. Can be a user-defined variable or field.

Return value: undefined, or the user-defined variable or field.

on-submit will not trigger when a simple dialog is dismissable by selecting on the backdrop or the user pressing Esc key.

submit-text and cancel-text

Optional

Type: string

Default: The default submit (primary) button text is OK and for confirmation dialogs the default cancel button text is Cancel. These will be translated by default.

<dialog id="tc-dialog" title="Terms and agreements" subtext="Do you agree to these Ts and Cs?" submit-text="Agree" cancel-text="Disagree">

The submit-text and cancel-text attributes allows for changing the default text on the dialog.

Be as specific as possible with button copy to avoid ambiguity. Instead of "Yes", rather repeat the action that a button will trigger - for example "Discard", "Save" or "Reset"

<dialog id="tc-dialog" title="Terms and agreements" subtext="Do you agree to these Ts and Cs?"
        on-submit="$:agree(true)" on-cancel="$:agree(false)"
        submit-text="Agree" cancel-text="Disagree">
function showTsAndCs() {
    component.dialog({id: "tc-dialog"}).show();
}

function agree(ok){
    if (ok) {
        // Logic here
    } else {
        // Other logic here
    }
}

subtext

Optional

Type: string

Default: unset

<dialog
    id="task-added"
    title="Job added"
    subtext="Your job with job-id:{$:getJobId()}\nwas added successfully"
/>
<dialog id="task-added" title="Job added" subtext="Your job with job-id:{$:getJobId()}\nwas added successfully"/>
function onTaskAdded() {
    component.dialog({id: "task-added"}).show();
}

function getJobId() {
    return view.currentJob.id_code;
}

Component Methods

scrollIntoView

Programmatically scroll until the component is visible in the view.

Type: string (static text, a or the return value of a )

on-cancel is an event that calls a JS/TS or . See more details:

on-submit is an event that calls a JS/TS or . See more details:

See example for .

Subtext provides more detail to the user about the purpose of the dialog. The subtext attribute can be a and it also supports newline characters.

The following component methods are available when an is assigned to the component and component.dialog({id:'my-id'}) is called from JS/TS:

💻
id
format string
JS/TS function
$:function
navigation
JS/TS Events
$:function
navigation
JS/TS Events
format string
id
the journey.dialog documentation
notifications
Simple
Confirmation
Composition
on-cancel