Special deal!
SAVE UP TO 50% OFF!
Grab now

Amelia JavaScript Hooks for Event form

Please note that using hooks requires a certain level of programming skills and included support refers only to advice. These hooks are only triggered on the new event list form ([ameliaeventslistbooking])

Parameters

  • success function
    Success callback function. Only used for ‘beforeBooking’ hook
  • error function
    Error callback function. Only used for ‘beforeBooking’ hook
  • data object
    Event and booking data object

Form loaded

The hook ‘ViewContent’ is triggered after the form has loaded

window.ameliaActions = {
  ViewContent: function (success = null, error = null, data) {
    console.log('ViewContent HOOK')
    console.log(data)
    console.log('------------')
  }
}

Event selected

The hook ‘SelectEvent’ is triggered when the event is selected/changed in the form

window.ameliaActions = {
  SelectEvent: function (success = null, error = null, data) {
    console.log('SelectEvent HOOK')
    console.log(data)
    console.log('------------')
  }
}

Info step loaded

The hook ‘InitInfoStep’ is triggered when the customer information step is loaded

window.ameliaActions = {
  InitInfoStep: function (success = null, error = null, data) {
    console.log('InitInfoStep HOOK')
    console.log(data)
    console.log('------------')
  }
}

Custom validation on info step

The hook ‘customValidation’ is triggered when the customer information step is validated, before the payment step loads

window.ameliaActions = {
   customValidation: function (success = null, error = null, data) {
    console.log('customValidation HOOK')
    console.log('------------')
    console.log(data)
   
    const customValidator = (rule, value, callback) => {
      if (value.includes('SOME_REGEX')) {
        callback(new Error())
      } else {
        callback()
      }
    }
    // this example is for email input field
    data.rules.email.push({message: 'CUSTOM MESSAGE', validator: customValidator})

    // this example is for a custom field
    var customFieldId = 2
    data.rules['cf' + customFieldId].push({message: 'CUSTOM MESSAGE', validator: customValidator})

  }
}

Payment step loaded

The hook ‘InitiateCheckout’ is triggered when the payment step is loaded

window.ameliaActions = {
  InitiateCheckout: function (success = null, error = null, data) {
    console.log('InitiateCheckout HOOK')
    console.log(data)
    console.log('------------')
  }
}

Confirm button clicked

The hook ‘beforeBooking’ is triggered the “Confirm” button is clicked but before the booking is completed. This hook currently doesn’t work for Mollie and WooCommerce payments

window.ameliaActions = {
   beforeBooking: function (success = null, error = null, data) {
    console.log('Before booking is created HOOK')
    console.log(data)
    console.log('------------')
    // call success callback for the booking to be completed
    success()
  }
}

On-site booking completed

The hook ‘Schedule’ is triggered after an on-site booking is completed, before the congratulations step is loaded

window.ameliaActions = {
   Schedule: function (success = null, error = null, data) {
     console.log('Schedule HOOK')
     console.log(data)
     console.log('------------')
  }
}

Online booking completed

The hook ‘Purchased’ is triggered after an online booking is completed, before the congratulations step is loaded

window.ameliaActions = {
    Purchased: function (success = null, error = null, data) {
      console.log('Purchased HOOK')
      console.log(data)
      console.log('------------')
  }
}