> For the complete documentation index, see [llms.txt](https://docs.logicdialog.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.logicdialog.ai/creating-your-bot/forms.md).

# Forms

[Forms](/fundamentals/forms.md) are the basis of requesting information from the user. You can create any number of forms you wish, and each form can contain any number of questions.&#x20;

<div><figure><img src="https://292592888-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8n7b8WayyGW9wX1onxly%2Fuploads%2Foy8ISwS2ijrzY622Q2O5%2FScreenshot%202023-02-01%20at%2009.23.02.png?alt=media&amp;token=65dd62af-0fe3-4f0e-a872-f6c2563f3c09" alt=""><figcaption></figcaption></figure> <figure><img src="https://292592888-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8n7b8WayyGW9wX1onxly%2Fuploads%2FSHBuDSlRmO96pX50NDnO%2FScreenshot%202023-02-01%20at%2009.23.12.png?alt=media&amp;token=b5512491-1fce-439f-8c82-efb241f0782a" alt=""><figcaption></figcaption></figure> <figure><img src="https://292592888-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8n7b8WayyGW9wX1onxly%2Fuploads%2FKzk6Oc6UT7RtRzuld3qi%2FScreenshot%202023-02-01%20at%2009.23.32.png?alt=media&amp;token=d0c28c76-1bf2-4816-914b-2f21a702185e" alt=""><figcaption></figcaption></figure> <figure><img src="https://292592888-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8n7b8WayyGW9wX1onxly%2Fuploads%2Fq9xFFRXRQqQZbRXDBPcX%2FScreenshot%202023-02-01%20at%2009.23.50.png?alt=media&amp;token=45caa609-d1e1-481a-b4c8-5b9eeca47d6d" alt=""><figcaption></figcaption></figure></div>

Creating a form is simple, just follow these few steps :

* [ ] To create a form, go to the Forms tab and select `Add form` in the top right-hand corner of the screen.
* [ ] Give your form a title.
* [ ] You can then choose whether to create your own question or to browse the question bank for pre-existing questions.\
  \
  For a question that already exists, you can select the tick box on the right while browsing the question bank. Then that question will be added to the form.\
  \
  If you use a `predefined` question (one that comes with logicdialog as standard) you won't be able to edit the wording. However if you use a question that has been created by your organisation, you can. Just be mindful that any edits will change the question for every form that uses it.&#x20;
* [ ] To create a new question, select `new question` then choose what type of question you would like to use. There are six choices in total; `Freetext` allows users to type any answer, `Choice` for button answers only, `Flexible` allows either freetext or choice, `Date` allows the user to select a date, `Email` for capturing someones email address and `Location` which opens up a map they can choose their exact GPS location.
* [ ] Next add the title and the question wording.\
  \
  The `Data Type` field lets you tell IntelAgent what to expect. A `String` can be any typed answer, while a `Number` must be digits. This is useful for if you ask for things like telephone numbers and the bot then receives any letters in the string, it will know the answer isn't what was asked for and will ask the user to try again.
* [ ] If you have included a `Choice` in the `Field Type` then the `Options` area is for defining the choices, or buttons, the user will be able to select in answer to your question. The `Title` is the button label the user sees. The `Value` is the piece of information you want the system to record. Sometimes these are the same, sometimes they aren't. When you've defined the button title and value, select the tick icon to save that choice.
* [ ] Once you've added any button options needed, select `Save Form` to save the form.

### Using a form in your flow design

To ask the question, or series of questions via a form in a conversation you'll need to use a `Function` block. When editing this block, you'll see a field called `Form` which tells the block which questions to ask the user at this time. In the drop down list you'll see all the questions and forms available to use.&#x20;

<figure><img src="https://292592888-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8n7b8WayyGW9wX1onxly%2Fuploads%2FvRaBay4gIAFfkFzN4YtS%2FScreenshot%202023-02-01%20at%2010.02.13.png?alt=media&amp;token=58e1ece9-8158-4dfb-8913-f1e538aeef00" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
As you can also ask single questions, rather than just forms it makes sense to split your questions into reusable pieces. For example creating a question that asks for an email address will allow you to reuse it later, not just in a form.&#x20;
{% endhint %}

### Reusing form values

When testing your bot you may have noticed that sometimes it doesn't ask you questions in the form that are associated with a given block. This is deliberate because the bot remembers your details from a previous conversation you had with it. We have purposely designed logicdialog to do this, as from a user perspective - you expect the bot to remember your email address after you've input once in the conversation. For example, if your bot handles multiple use cases where a user might enter their email address then the second time they complete one of the use cases we can reuse the email address from before.&#x20;

There are times however that you might want the bot to forget the details. For those times, you can use the `Unset form` function which will reset the form values.

### Resetting the form values

If you want to make sure that the bot forgets any answers it has captured through a form, include the `Unset form` function when the bot has finished using the answers for what it needs. You can do this either from the `Responses` screen, or when on the `Visual Builder`.&#x20;

<figure><img src="https://292592888-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8n7b8WayyGW9wX1onxly%2Fuploads%2FBFhIa8lyYLf66WjGCxcK%2FScreenshot%202023-01-31%20at%2013.53.51.png?alt=media&amp;token=5986bd34-c563-4914-8b4f-9f5f86689f61" alt=""><figcaption></figcaption></figure>

From the `Visual Builder` add a `Next Response` to the block of content that finished processing the form. Choose the `Unset form` block type from the preset functions. Populate as normal and choose the form you wish to unset in the form field. When you're finished remember to set a next block for the block you just added if you want the bot to send anything else to the user.

### A Practical Example&#x20;

This video shows a form you could set up in your own bot in a matter of minutes.

{% embed url="<https://vimeo.com/815312385>" %}
