Using Migx with Formit

Hello everyone,

I’m using formit for a contact form that has a dropdown for topics. Based on the selected topic, the data will be send to a specific email address. The site admin must be able to manage the topics and emails, so I created a migx tv to store the topic-email pairs.

I’m displaying the topics in the form with getImageList, and they show correctly, but the email isn’t send, even though I get a success message. If I replace the getImageList call with hard coded options, the email gets through.
Here is my code:

<select name="subject" class="form-control">
       <option value="" disabled="" selected=""> [[%contact.form.topic.select? &namespace=`language` &topic=`default`]]</option>
         [[!getImageList?
              &tvname=`contact_topics`
               &tpl=`topics_tpl`]]
</select>

and in the tpl I used both:
<option value="[[+topic]]">[[+topic]]</option>

and
<option [[!+fi.subject:FormItIsSelected=[[+topic]]]]>[[+topic]]</option>

With the same outcome, the email isn’t sent.
Any ideas why this happens?
Thanks!

Hi,

Welcome back.
Can you share your formit call so we can try to help you?

Thanks

<option [[!+fi.subject:FormItIsSelected=`[[+topic]]`]]>[[+topic]]</option>

You forgot the value here.

<option [[!+fi.subject:FormItIsSelected=`[[+topic]]`]] value="[[+topic]]">[[+topic]]</option>

1 Like

Hi,

Thank you for your replies.

@jnogueira This is my formit call:

[[!FormIt? 
    &hooks=`spam,email,FormItSaveForm`
    &validate=`subject:required`
    &emailTpl=`ContactFormEmailChunk `
    &emailTo=`email1@email.com, email2@mail.com`
    &emailSubject=`MFA - Contact form`
    &successMessage=`<div class="alert alert-success container">
            <button type="button" class="close" data-dismiss="alert">&times;</button>
            <h5> [[%contact_form_thanks_message? &topic=`default` &namespace=`language`]]</h5>
            </div>`
]]

@jako yeah, I noticed now, but I only forgot in this post, not in the tpl.

I found the reason the emails were not sent. I removed one of the test emails I was sending to, and after that, everything worked fine. I just don’t understand why was this happening. Any thoughts?