We’re using a custom StoreFormDataBehavior and currently the default ConfrimationEmailBehavior.
We’re finding that the confirmation behavior is firing before storing the data, so users are receiving confirmations before data is persisted. This means they get a success message even when there is a failure to persist.
Is there a way to dictate the order of behaviors, bearing in mind these both fire OnValidationSuccess?
Probably yes, by changing the order within the value of the configured “behaviors” parameter of the component.
The value is comma separated which the code reads with a simple split(",") method so it should work.
Main problem is that this is not an atomic operation:
once validated, those behaviors are executed in sequence (loop) and it can happen that some of them fail, but client is not informed about it. e.g.
lets say you email the client (EmailBehavior) and also persist your form (storage behavior). Email might go well and storage might fail. However, client is presented with “Ok” message in some cases (if Behavior does;t throw EformsException for example).
@jeroen.hoffman Thanks for that solution, we were just using the addBehavior() method, which doesn’t respect order.
@machak This is what we’re trying to solve. The first step is ordering, now we will have to manage some form of state on the FormMap object.