In BotFramework V4 you can validate user inputs using your own validator function:
dialogs.Add(new TextPrompt("textPrompt", TextPromptValidatorAsync));
But there is also a Validations Property in PromptOptions class.
return await step.PromptAsync(
TextPrompt,
new PromptOptions
{
Prompt = MessageFactory.Text("What is your name?"),
Validations = ??
},
cancellationToken);
What is it for?
Validations are objects that can be used to validate the responses from users.
The sample here shows an example. Essentially in this sample, it is using an async Task:
public Task<bool> CustomPromptValidatorAsync(PromptValidatorContext<string> promptContext, CancellationToken cancellationToken)
This has the logic to actually check what is valid. Then this is passed in when adding the TextPrompt dialog:
_dialogs.Add(new TextPrompt("name", CustomPromptValidatorAsync));
The Validations property is how you can access that object.