Chatbot Control Events

Events are added to a Persona Form to perform specific inline tasks, such as resetting the form, closing the connection or saving the data. Here we cover the syntax for each and provide an example.

General syntax

Events are always <input> in a <form> and must have a name and data-type=’event’

 <input name="test_event" data-type="event data-event='bye' /> 

Additionally every event needs data-event set to one of the documented events.

  • data-event=event type
  • data-dbname=name of database
  • data-posturl=url

Most events have limits on the type of form they can be used in: load, background, or action. This will be noted.

bye

Closes the connection with a bye

<input name="test_event" data-type="event data-event='bye' data-opt='start' />

use in form: load

reset

resets the form back to start, clears inputs

<input name="test_event" data-type="event data-event='reset' data-opt='start' />

use in form: load / background / action

exit

reset and return to the caller form if any

<input name="test_event" data-type="event data-event='exit' data-opt='start' />

use in form: load / background / action

save

saves the form instance to the context, then resets form

<input name="test_event" data-type="event data-event='save' data-opt='start' />

use in form: load / background / action

save_db

Saves the form and its inputs as an instance of the object in the DB, then resets form

<input name="test_event" data-type="event data-event='save_db' data-opt='start' data-dbname='default'/>

use in form: load / background / action

save_post

POSTS the form and its inputs to defined URL, then resets form

<input name="test_event" data-type="event data-event='save_post' data-opt='start' data-posturl='http://api.sedro.xyz/api/depots/testformdatapost' />

use in form: load / background / action

background

switch Active form to background again

<input name="test_event" data-type="event data-event='background' data-opt='start' />

use in form: background

background_reset

switch Active from to background form, then resets form

<input name="test_event" data-type="event data-event='background_reset' data-opt='start' />

use in form: background

activate

for background Form, this will make it the active form.

<input name="test_event" data-type="event" data-event='activate' data-opt='start' />

use in form: background

To Be Continued…

In the next blog on Forms we will focus on Background Forms http://blog.sedro.xyz/2020/01/29/background-forms/

One Reply to “Chatbot Control Events”

Comments are closed.