Events
You can pass in a cf.EventDispatcher
instance to listen for events of your Conversational Form instance.
var dispatcher = new cf.EventDispatcher();
dispatcher.addEventListener(cf.FlowEvents.FLOW_UPDATE, function(event){
// your code here
}, false);
var cf = new cf.ConversationalForm({
formEl: document.getElementById("my-form"),
eventDispatcher: dispatcher
});
All events are CustomEvents, expect the detail object to contain data.
cf.EventDispatcher()
implements the EventTarget interface
List of events
Event name | Description |
---|---|
cf.TagEvents.ORIGINAL_ELEMENT_CHANGED | Original tag (dom element) has changed value.
|
cf.FlowEvents.USER_INPUT_UPDATE | When ever the UserInput element changes value.
|
cf.FlowEvents.USER_INPUT_INVALID | When an error has been registered.
|
cf.FlowEvents.FLOW_UPDATE | When ever the flow of Conversational Form is updated.
|
ChatListEvents.CHATLIST_UPDATED | When the chatlist has been updated.
|
cf.ChatResponseEvents.USER_ANSWER_CLICKED | When user clicks a previous answer.
|
cf.ControlElementEvents.ON_LOADED | When an control element is loaded, like when an control element contains an image. |
cf.ControlElementEvents.ON_FOCUS | When focus on an control element.
|
cf.ControlElementEvents.SUBMIT_VALUE | When control value has changed, ex. clicking a check-box, radio-button etc.
|
cf.UserInputEvents.CONTROL_ELEMENTS_ADDED | When a control element has been added.
|
cf.OptionButtonEvents.CLICK | Option element click, normally you would use cf.ControlElementEvents.SUBMIT_VALUE.
|
cf.ControlElementEvents.PROGRESS_CHANGE | Upload a file, get progress event.
|
cf.UserInputEvents.HEIGHT_CHANGE | When height of input field change.
|
cf.UserInputEvents.KEY_CHANGE |
|
cf.UserInputEvents.SUBMIT | On user submits value.
|
cf.UserInputEvents.FOCUS | On user input field Focus. |
cf.UserInputEvents.BLUR | On user input field Blur (focus removed). |
cf.MicrophoneBridgeEvent.TERMNIAL_ERROR | When Microphone interface terminates. |
cf.ControlElementsEvents.CHANGED | When control elements changed, added or removed elements. |
cf.ControlElementsEvents.ON_RESIZE | When control elements resizes. |