Reputation: 504
I can't seem to find a way to post a message to the user in the FormFlow based on how the user answers a bool. To post Fields based a previous answer you can use:
.Field(new FieldReflector<GetQuoteDialog>(nameof(Dothis))
.SetActive((state) => state.isDone== true))
However I haven't found a way to do the same with the .Message(). So say if I want to just send the message "Congrats!", then post the next question in the formflow.
So the dialog I would like to play out would be like:
Is there a way that I am just missing?
Upvotes: 0
Views: 319
Reputation: 13918
You can leverage the second parameter of .Message()
which is condition delegate function, from source code:
// Summary:
// Show a message that does not require a response.
//
// Parameters:
// message:
// A \ref patterns string to fill in and send.
//
// condition:
// Whether or not this step is active.
//
// dependencies:
// Fields message depends on.
//
// Returns:
// Modified IFormBuilder.
IFormBuilder<T> Message(string message, ActiveDelegate<T> condition = null, IEnumerable<string> dependencies = null);
So, please try:
.Message("Congrats", condition: (form) => form.boolField == true)
Upvotes: 1