on-press

Optional

Default: unset

Triggered when: Specific per component. Please see the table below.

Event parameter: Specific per component. Please see the table below.

Return value: Specific per component (based on field type). Please see the table below.

on-press is an event that calls a JS/TS $:function or navigation. See more details:

JS/TS Events

Note: The on-press function will call validation (as specified by the validate attribute) if set.

Component-specific details

Component
Triggered when
Event parameter
Return value

A row/cell/item is selected.

$selection

Selected object

action (edit-typeahead)

The user clicks on an object in the list.

$object, searchValue

  • Selected object

  • A string containing the entered search text.

A button is selected.

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

undefined, or the user-defined variable or field.

item (context-menu, navigation general-section)

An item is selected.

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

undefined, or the user-defined variable or field.

marker / marker-query (capture-coordinates, display-coordinates)

A marker is selected.

$value

Location object containing the latitude and longitude, e.g. {latitude: 39.7553694, longitude: -105.0195773}

Example:

main.view.xml
<button label="Submit" on-press="$:submitForm(current_form)"/>
main.js
function submitForm(currentForm) {
    // Add logic here
    // Could be a navigation call, e.g. 
    // navigate.link("submit_form", currentForm)
}

Last updated