Skip to content

Special Functions

Special Functions in Client Side JS

In Aliveforms there are special functions. these functions enable creating Single-Condition-Logic. if these functions are defined, they are executed on specific occasions.

Event Handling

In new update, Aliveforms forms dispatches events of same type. Event handlers can be registered using $.Handle JavaScript API.

Read about events here

  • screen_index_input_change
  • screen_index_on_next_pre
  • screen_index_on_next
  • screen_index_on_back
  • screen_index_on_enter

these functions has access to following variables:

  • inputs
  • weights
  • uploads

screen_index_input_change

If using JavaScript API, if special function screen_index_input_change is defined, then it's body is executed when screen input is changed by user.

screen_index_on_next_pre

If using JavaScript API, if special function screen_index_on_next_pre is defined, then it's body is executed when next button is clicked. It is executed before validation.

screen_index_on_next

If using JavaScript API, if special function screen_index_on_next is defined, then it's body is executed when next button is clicked. It is executed after validation.

screen_index_on_back

If using JavaScript API, if special function screen_index_on_back is defined, then it's body is executed when back button is clicked.

screen_index_on_enter

If using JavaScript API, if special function screen_index_on_enter is defined, then it's body is executed when form screen in rendered.

Usage

Ideally, these can be used in screen -1 , i.e. boot.

window.screen_2_input_change = function() {
  console.log('inp', inputs[2])
}
window.screen_1_on_next_pre = function() {
    ...
}
window.screen_1_on_next = function() {
    ...
}
window.screen_1_on_back = function() {
    ...
}
window.screen_1_on_enter = function() {
    ...
}

Single Condition Logics

Using these functions, it is possible to construct Single Condition Logic. That means, whole form can be programmed from single condition by using function of applicable indexes.