Conflict with MailChimp embedded form

citananda's picture
citananda
Mon, 02/13/2017 - 12:01
#1
Conflict with MailChimp embedded form

Hi,

I created a block including a MailChimp embedded form and added it on a page builded with MD Awecontent.

Now my page is brocken, and I got this javascript error :

Uncaught TypeError: i.init is not a function
at HTMLSelectElement.<anonymous> (js_-PGRGsKNHNNfItZKUBrpaMN3h1wI9repOTliXu0veQE.js:1058)
at Function.each (js_BocpO7oV2V9m_et9Sfy-yRJG7oHvwVFyyZ9yKoQrDBM.js:657)
at $.fn.init.each (js_BocpO7oV2V9m_et9Sfy-yRJG7oHvwVFyyZ9yKoQrDBM.js:266)
at $.fn.init.e.fn.select2 (js_-PGRGsKNHNNfItZKUBrpaMN3h1wI9repOTliXu0veQE.js:1058)
at HTMLSelectElement.<anonymous> (js_-PGRGsKNHNNfItZKUBrpaMN3h1wI9repOTliXu0veQE.js:612)
at Function.each (js_BocpO7oV2V9m_et9Sfy-yRJG7oHvwVFyyZ9yKoQrDBM.js:657)
at $.fn.init.each (js_BocpO7oV2V9m_et9Sfy-yRJG7oHvwVFyyZ9yKoQrDBM.js:266)
at HTMLDocument.<anonymous> (js_-PGRGsKNHNNfItZKUBrpaMN3h1wI9repOTliXu0veQE.js:611)
at fire (js_BocpO7oV2V9m_et9Sfy-yRJG7oHvwVFyyZ9yKoQrDBM.js:3048)
at Object.fireWith [as resolveWith] (js_BocpO7oV2V9m_et9Sfy-yRJG7oHvwVFyyZ9yKoQrDBM.js:3160)

Please help me

citananda's picture
citananda
Tue, 02/14/2017 - 08:16

You can see the problem on the front page of the website : http://blog.capyoga.fr/

citananda's picture
citananda
Tue, 02/14/2017 - 08:31

I found that if I remove from my block the following line, it works

<div class="mc-field-group"><label for="mce-IAM">Je suis...</label> <select class="required" name="IAM"><option value=""></option><option value="Juste intéressé">Juste intéressé</option><option value="Pratiquant occasionnel">Pratiquant occasionnel</option><option value="Pratiquant régulier">Pratiquant régulier</option><option value="Professeur de yoga">Professeur de yoga</option><option value="Un studio de yoga">Un studio de yoga</option> </select></div>

So the problem comes from select object, and I can see in the console that the code is breacking here :

this.each(function() {
if (n.length === 0 || typeof n[0] === "object") {
r = n.length === 0 ? {} : e.extend({}, n[0]);
r.element = e(this);
if (r.element.get(0).tagName.toLowerCase() === "select") {
u = r.element.prop("multiple")
} else {
u = r.multiple || false;
if ("tags"in r) {
r.multiple = u = true
}
}
i = u ? new window.Select2["class"].multi : new window.Select2["class"].single;
i.init(r)

The message error is Uncaught TypeError: i.init is not a function.

Please help beacause I need to use select object in my MailChimp form.

Many thanks beforehands
Christophe

citananda's picture
citananda
Tue, 02/14/2017 - 10:48

Ok my problem is solved, the problem was that the module and librairie select2 where needed, and where not installed.

So I installed both and now it is working perfectly.

Log in or register to post comments
Have More Idea?

We are here to build your website!

No Universal solution fits all special business requirements. Our experienced team is ready with ideas and state-of-the-art technical solutions to consult the best solution within your budget.