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
  • screen_index_timer_expire
  • form_on_submit
  • form_on_submit_pre
  • form_on_submit_error

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_timer_expire

If using JavaScript API, if special function screen_index_timer_expire is defined, then it's body is executed when timer of screen is expired.

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.

form_on_submit

If using JavaScript API, if special function form_on_submit is defined, then it's body is executed when result/response screen is shown.

form_on_submit_pre

If using JavaScript API, if special function form_on_submit_pre is defined, then it's body is executed when form submission is being prepared and wait screen is shown.

form_on_submit_error

If using JavaScript API, if special function form_on_submit_error is defined, then it's body is executed when there is error in form submission.

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.