We are using FormFlow in our bot. FormFlow has a feature that allows a user to type the name of the field and it switches to the given field. Let's say we have a model class like this
public class SampleModelClass
{
public string FirstField { get; set; }
public string SecondField { get; set; }
}
When the user is asked to enter FirstField there is a possibility that the user can actually type "first field" which results in asking the question for the FirstField again. Is there any way to disable this and take "first field" as the value of FirstField? Renaming FirstField would work, but we are looking for a better solution
When the user is asked to enter FirstField there is a possibility that the user can actually type "first field" which results in asking the question for the FirstField again. Is there any way to disable this and take "first field" as the value of FirstField? Renaming FirstField would work, but we are looking for a better solution
You can try to use the Terms attribute (with a regular expression) to define the list of terms that are used to match user input to a field or a value in a field, the following sample is for your reference.
[Serializable]
public class SampleModelClass
{
[Terms(@"^[.*]$")]
public string FirstField { get; set; }
[Terms(@"^[.*]$")]
public string SecondField { get; set; }
public static IForm<SampleModelClass> BuildForm()
{
return new FormBuilder<SampleModelClass>()
.Message(async (state) => { return new PromptAttribute($"Welcome to the form bot!"); })
.Build();
}
}
Test result: