Leopard Chat Client
  • Quick Start
  • Screenshots
  • Setup
    • Extension Helper
    • Context Variables
      • Greeting Message
      • Channel
      • User's Time Zone
      • Location Context Parameters
    • Build Variables
  • Content Styling
    • CSS Styles
    • Icons
    • Markdown & HTML
  • Components Simple Syntax
  • Components
    • Answer Borders
    • Audio Player
    • Auto Open Leopard with Link
    • Alerts
    • Buttons and Lists
    • Card
    • Response Icons
    • Date & Time Pickers
    • Emergency Button
    • Expensive Operations
    • Field Masks
    • Chat Field Types (Email, Password, Location, Upload)
    • Forms
      • Feedback Form
      • Custom Forms
        • Example Config
        • Postback Object
        • Button Object
        • Field Types
        • Style Object
        • Icons Object
        • Masks
        • Validation
    • Google Map
    • Help Text
    • HTML Modal
    • Hyperlinks
    • Images
      • Image
      • Image Carousel
    • Tables
      • Tables - Simple
      • Tables - Advanced
    • Theme Change
    • Toasts
    • Language Auto Switch
    • Minimize Chat after Delay
    • Multiple Components - Same Response
    • Modal Size & Positioning
    • Open Long Response in Modal
    • Print Icon
    • Prompt Trigger Polling
    • Splitting Answers - Chunks
    • Video Player
  • Administration Area
    • Solution Configuration
    • Demo Mode - iFrames & URLs
    • ASR and TTS
  • Integrations
    • Logging / Reporting
    • Social Authentication
    • Live Chat
  • Embedding / Production
Powered by GitBook
On this page
  • Introduction
  • Behavior
  • Output Parameter
  • Form Config Component Configuration
  1. Components
  2. Forms

Custom Forms

Create and display custom forms in Leopard for any Teneo response. Styling, icons, validations, input, text areas, selects, combo boxes, images, headers, html, sliders, check boxes, switches & radios

PreviousFeedback FormNextExample Config

Last updated 5 years ago

Introduction

A form will only ever display in a modal window. You have control over the max width of the form but you can't control its position on the page. It always be displayed in the center of the page.

Although you can capture any input via dialog through the course of conversation it can be more familiar and user friendly to display a traditional form to a user at a key point of a conversation. Having this option in Leopard doesn't force the use or display of custom forms in any solution but rather provides flexibility in confirming or capturing information outside of lengthy conversations.

You have great control of the form structure, appearance, behavior, initial values and validation rules.

ExtensionHelper is NOT currently used to provide helper functions to generate the JSON structure needed by Leopard to render forms. You are more than welcome to create and contribute some if you're up for it.

It should however be straight forward to construct your necessary JSON based form config using the guidance and examples provided.

Sensible defaults are set for the bulk of the form config options so the final JSON can be very slim if you are happy with the defaults.

Behavior

A custom form is currently tied directly to the respective output node that returned the "formConfig" as an output parameter.

This means that the form button against that response will be displayed in the chat dialog until the user completes the form and submits it back to Teneo. At that point the form button in the chat UI is removed from that particular response.

Current configuration is that the same form and button can be displayed in new responses if new dialog takes you there. If you want to prevent the offer of a custom form that has already been submitted then that logic needs to be engineered server side in Teneo around the "postback" data that is posted back to Teneo on a successful submission.

The form button can remain visible in the dialog until it's completed and submitted back. Therefore you should configure the "postback" information of the form to align with your flow strategy for capturing and responding to the data posted back Teneo.

At present a user isn't forced to complete a form in the current turn of the active conversation. Therefore you should plan accordingly in Teneo.

Custom Forms will operate both in "Demo" mode as well as "Production" embedded mode.

Due to the current implementation of Leopard in production the form will only be overlaid over the chat UI area of the chat client.

It will not be centered and wide as it is in development mode. Therefore if you plan to use custom forms in a production install of Leopard you should expect your form to render in a smaller and narrower area.

Output Parameter

formConfig = {
  "title"  : "My Custom Form",
  "fields" : [
    {
      "header" : {
        "label" : "Please enter in your email address"
      }
    },
    {
      "textInput" : {
        "name"           : "username",
        "label"          : "Email",
        "hint"           : "Just the username part please",
        "initialValue"   : "jolzee",
        "placeHolder"    : "username",
        "style"          : { "solo":true },
        "clearable"      : true,
        "persistentHint" : true,
        "icons"          : { "appendOuter":"email-edit" },
        "suffix"         : "@gmail.com",
        "validations"    : "required"
      }
    },
    {
      // ... other fields
    }
  ]
}

Form Config Component Configuration

Element

Required/Optional

Default Value

Type

Notes

title

required

String

The form's title

validationFailedMessage

optional

Please complete all required fields

String

A custom message to be displayed once a user submits the form and there are validation errors

openAutomatically

optional

false

Boolean

Controls if the form should automatically open for the Teneo response that contains the formConfig

openFormButtonText

optional

Form

String

Set the button text to open the form. Seen just below the answer text.

optional

Object

Controls what is send back to Teneo on a successful submission of the form

optional

Object

Controls the display of the button used in the form to complete the form submission

required

Array of Field Type Objects

It's worth while to use a online before committing your final formConfig JSON in Teneo.

A more comprehensive example can be

Allows you to add as many of the available in a specific order

JSON validator
found here
Example Config
Postback Object
Button Object
Field Types
Style Object
Icons Object
Masks
Validation
postback
Postback Object
button
Button Object
fields
Field Objects
fields
Example Custom Form with Validation