Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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.

...

View file
nameHTML_Directive.json

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

Filter by label (Content by label)
showLabelsfalse
max5
spacescom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@130ff

...

...

sortmodified

...

showSpace

...

false
reversetrue

...

typepage
cqllabel in ( "how-to" , "directive" , "experience-designer" ) and type = "page" and space = "OCS"
labelsdirective experience-designer how-to