I am currently developing a simple chat-bot application using the Azure Bot Framework, implemented using C# and formflow, and testing in Bot Emulator V4.
I have been OK thus far, using mostly intuition and a few online resources, but I've recently hit a bit of a hurdle and have found the documentation on conditional fields in FormFlow to be rather sparse.
In short, the scenario is as follows:
- The form asks about individuals
- The second last question is a 'yes' or 'no' as to whether the user has any problems
- The final question them detail their problems, should they have any
The latter should, really, only be visible if the user's response to the penultimate question was 'yes'. If the user responds 'no' to having any problems, the bot should ignore the 'problem description' field.
At the moment, I have:
public enum HadProblem
{
Yes, No
};
The options.
[Prompt("Have you had a problem? {||}")]
public HadProblem? Problem;
A prompt, and the 'yes' and 'no' options visible to select.
The final question is simply a string input:
[Prompt("Please give a {&} of the problem.")]
//[Optional]
public string description;
At the moment, as you can see, I had been using the '[optional]' tag, as it was the closest replacement for conditional fields. I'm struggling to find documentation which covers how to create a field, whose appearance is conditional on another field value.
Is there a way that I can make the problem description field be visible/answerable, only if the response to 'HadProblem' was 'Yes'?
It's really untidy having to manually skip the question, if the answer was 'no'.
Thanks in advance.