...
To handle the Submit button from the HTML form, you have to create a function in the Custom JS tab of the Bot View Template node and use the self.submitQuery property.
...
Saving the user input from HTML directive
You can make an interactive HTML form and get input from the chatbot users and store that data.
In the below example, you can collect the Firstname and Lastname of the chatbot users when they click on the Submit button.
Code Block |
---|
msg.payload.orbita.directive =
[{
type : "html5",
options :
{
// template : "300x300",
html : `<form> <label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<button onclick="window.parent.submitQuery('Your data submited', 'User data', null, {fname: document.getElementById('fname').value, lname: document.getElementById('lname').value});">Submit</button> </form>`
}
}]
return msg; |
The First name and the Last name will be available in the property msg.payload.originalDetectIntentRequest.payload.extPayload
Related articles
Filter by label (Content by label) |
---|
showLabels | false |
---|
max | 5 |
---|
spaces | com.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@130ff |
---|
|
...
...
...
...
...
type | page |
---|
cql | label in ( "how-to" , "directive" , "experience-designer" ) and type = "page" and space = "OCS" |
---|
labels | directive experience-designer how-to |
---|
|