Hi guys im using formflow, everything is working smoothly, i just have some small details that i need to fix.
- Is there a way for me to check via regex the user inputs during the formflow? i need to check if the user inputs a valid name, email etc.
- Can i change the confirmation before profile complete to a yes or no button instead of typing yes or no or y or n?
Below is the code
[Serializable]
public class ProfileForm
{
[Prompt("What is your first name? {||}")]
public string FirstName;
[Prompt("What is your last name? {||}")]
public string LastName;
[Prompt("What is your email? {||}")]
public string Email;
public static IForm<ProfileForm> BuildForm()
{
return new FormBuilder<ProfileForm>()
.Message("Welcome to the profile bot!")
.OnCompletion(async (context, profileForm) =>
{
// Tell the user that the form is complete
await context.PostAsync("Your profile is complete.");
})
.Build();
}
}
So this hasn't been answered in a month so I hope by now you have found the answer yourself. If not, here is an easy way:
This way checks the string on input and will automatically request another try if it is incorrectly entered.
There are commonly used patterns for most of what you are looking for online. This post and this one are good at showcasing some of the ways to customise FormFlows. Hope this helps.
Edit. Sorry missed the second part of the question. To add a simple confirm button add this to your formflow:
The "{*}" will show all the fields and the users response and the "{||}" will show the Yes/No buttons that you want.