[[!FormIt? &hooks=`email` &validate=`emails:required` &successMessage=`<h2 style="color:green">Your invitation was sent to [[+emails]]!</h2>` &emailTpl=`email_event` &emailSubject=`Event Invitation - [[+eventName]] - [[!+company]]` &emailTo=`[[+emails]]` ]] <form action="[[~[[*id]]]]" method="post" id="eventform" > <label>Describe a list of emails separated by comma</label> <input type="text" name="emails" id="emails" value=""/> <input type="hidden" name="eventName" value=""/> <button type="submit" class="btn">Send</button> </form>
This question has been answered by yuliyepes. See the first response.
<?php $hook->formit->options['emailTo'] = $hook->getValue('emails');
Write a small hook with the following code
<!--?php $hook--->formit->options['emailTo'] = $hook->getValue('emails');
and execute that hook before the email hook.
The current code of FormIt could just work with [[+email1]],[[+email2]] and the according fields in the form, if I read the current code right.
$emails = $hook->getValue('emails'); $hook->formit->setOption('emailTo', $emails);