Forms Module Send To Different Email Based On User Drop Down Selection

b1gw0rm - 3 weeks ago

I have a client that would like to be able to have a submitted form go to different email addresses based on a user's selection from a drop down field in the same form. I'm curious as to what might some recommended approaches to something like this. I'm guessing there are several ways to do in Pyro or Laravel directly.

For simplicity I may just end up utilizing the basic parts of Laravel that Pyro runs on to process this customized form with a custom route and a custom controller to handle it but I wanted to know what the "Pyro way" might look like for this.

Answer

ryanthompson - 3 weeks ago

At this moment - I would probably duplicate the standard form handler extension and put your logic there. Maybe bundle it for later too. I could see that being popular.

You could also try overriding the form builder by binding it's class \Anomaly\StandardFormExtension\Handler\StandardFormBuilder or using .handler("My\HandlerClass\Exampe") to do it that way but.. your way it most definitely a decent idea too.

Laravel and Pyro go hand in hand so I look kindly on solutions using patterns / approaches from either!

ryanthompson - 3 weeks ago

At this moment - I would probably duplicate the standard form handler extension and put your logic there. Maybe bundle it for later too. I could see that being popular.

You could also try overriding the form builder by binding it's class \Anomaly\StandardFormExtension\Handler\StandardFormBuilder or using .handler("My\HandlerClass\Exampe") to do it that way but.. your way it most definitely a decent idea too.

Laravel and Pyro go hand in hand so I look kindly on solutions using patterns / approaches from either!