I have created a formflow in botframework. I want to change the confirmation options, by default it takes 'Yes' and 'No'. but i want it to proceed instead 'Yes', even if user inputs 'OK', 'Ya', 'Yeah' etc. how i can add options for confirmation
Asked
Active
Viewed 1,337 times
4
-
I know there are some ways to alter the way the form asks questions. this is done with annotations. But I haven't tried it yet with confirmations. Here is the documentation : https://docs.botframework.com/en-us/csharp/builder/sdkreference/dd/df7/namespace_microsoft_1_1_bot_1_1_builder_1_1_form_flow.html#a28ef6a551a3611e4a6abe06659797313 – Xeno-D Mar 22 '17 at 09:57
1 Answers
5
You need to add the new terms to the Yes
array of the FormBuilder configuration. Something like:
public static IFormBuilder<T> CreateCustomForm<T>()
where T : class
{
var form = new FormBuilder<T>();
var yesTerms = form.Configuration.Yes.ToList();
yesTerms.Add("Ya");
form.Configuration.Yes = yesTerms.ToArray();
return form;
}
That then you can use like:
return CreateCustomForm<MyForm>()
The reason of this would be something like the following:
The Confirmation field, set it's type to bool. At some point, a recognizer is defined for the field, based on it's type. In this, case, the Confirmation
field will use the RecognizeBool recognizer.
The recognizer uses the Yes/No arrays defined in the form's configuration (which initially they are retrieved from the resource file) for doing the parsing.
When the Confirmation
field is added to the Form, a ConfirmStep step is also added. The ConfirmStep is the one that later in the game ends up calling the recognizer to do the matching and parsing of the terms.

Ezequiel Jadib
- 14,767
- 2
- 38
- 43