Change .to() based on dropdown input

myshoeshurt - 3 weeks ago

Heya, quick question regarding forms. Let's say I have a dropdown inside one form and it's got 4 different options to select. Is it possible to alter the .to() option or .cc() in that form based on the dropdown selection? If yes, what would be the best approach?

Thank you very much!

Answer

ryanthompson - 3 weeks ago

The best way to do this is probably using a handler / setting a handler and changing the option within that logic.

...handler(MyHandler/Class)...

That should set it OK within Twig

ryanthompson - 3 weeks ago

The best way to do this is probably using a handler / setting a handler and changing the option within that logic.

...handler(MyHandler/Class)...

That should set it OK within Twig

myshoeshurt - 3 weeks ago

Thanks dude, it took some time to make it work, but it works perfectly :)