Open wiegertschouten opened 5 months ago
There's an open PR which would let addon developers register custom fields on the Form settings page, see statamic/cms#8491
@duncanmcclean that looks like a very useful PR indeed, it covers most of this idea. Gave it a 👍🏻
Still, I think it would be even more powerful if this is done in a more standardized form. That would make it easier for actions to be dependent on each other in a reliable way.
But maybe I'm trying to look ahead too much here 😅
Right now, the only action forms can do after someone submits them, is sending emails. Of course, one can hook into an event and write a listener. But wouldn't it be nice if one could pick other actions, right from the UI?
Concrete use cases: newsletter service subscriptions, automatic CRM entries, or payments. And there's probably a ton more.
I think it would be useful if one could register a form action with Statamic, which then becomes available as a simple button in the form's settings. Every action would register its own settings widget.
Activating the action on a form would be as simple as clicking the button and filling out the action's settings.
Actions could have conditional logic, based on field values. For example, a user would only be subscribed to a newsletter if they checked the corresponding checkbox.
And to level it up a notch: actions could depend on each other. For example, if a payment action could succeed or fail, and an email action would then run only when it succeeds.
I think I already heard Jack McDade mention something like this in a community call, but I'm not quite sure. It would be a welcome addition, so I'm posting it here anyway 🙂