Toggle menu

helper.triggerActionButton(actionName [, label] [,fieldID])

Triggers the specified action on the current page.

There must be at least one button on the page that implements the action. This button can be hidden. The label and fieldID are optional and will restrict the button being targeted. If no label is provided, all buttons that implement this action will be triggered.

Executed

Client-side only.

Arguments

ArgumentTypeDescription
actionNameString, requiredThe name of the action to be triggered. Actions are described in the override function section of the Wizard Buttons article.
labelString, optionalThe button label to match
fieldIDString, optionalThe ID of the button to target

Example

In this example the following handler has been added to a Radio Group field. The wizard button on that page of the form is hidden. When the value of a Radio Group field changes, it will trigger the NEXT function. The next button has the label "Continue".

function (helper, fieldName, value, valid, eventName) {
    if (eventName == "CHANGE" && valid) {
    helper.triggerActionButton("NEXT", "Continue");
  }
}

Alternatively, the fieldID could be used.

Note that care needs to be taken when using getFieldID in conjunction with triggerActionButton. In these circumstances your button's field name must not match one of the form action names (BACK, PREV, NEXT, FINISH etc) as those actions are themselves registered in the DOM and will be returned instead of the ID of the field.

function (helper, fieldName, value, valid, eventName) {
    if (eventName == "CHANGE" && valid) {
    helper.triggerActionButton("NEXT", helper.getFieldID("MYNEXTBUTTON"));
  }
}

This function works with a button generated by the Navigation Buttons Handlebars helper. Note how the button's identifier is used to find it within the template.

function(helper) {
    helper.triggerActionButton("NEXT", helper.getFieldID('MYTEMPLATE') + '_' + 'BUTTONIDENTIFIER');
}

Last modified on August 24, 2022

Share this page

Facebook icon Twitter icon email icon

Print

print icon