xpertbot / craft-wheelform

Craft CMS 4 Form with Database integration
MIT License
66 stars 32 forks source link

isValid for Events #311

Closed cloudgrayau closed 2 months ago

cloudgrayau commented 6 months ago

Hello,

Please allow us to stop the action of sending an email / saving to the database via the BEFORE_SAVE and/or BEFORE_SEND events. This could be via a $isValid attribute on the event/s.

Thanks,

xpertbot commented 2 months ago

I was looking into this. In the logic, if you add errors to the Event response, the message doesn't get saved in the database or send the email. However, I added a way to shortcircuit the form so you can skip saving to the database and/or sending the email. These new variables are: saveMessage and sendMessage on the EventMessage class. Thank you