I keep getting error in meteor when I add autoform select2 bundle


#1

When I add select2 to my code. The field does not work as expected (with multiple selections) it gets larger but when you click in it nothing happens. There is also this error in the console

https://atmospherejs.com/aldeed/autoform-select2

Exception from Tracker afterFlush function:
debug.js:41 TypeError: $s.select2 is not a function
at Template.afSelect2.rendered (autoform-select2.js:126)
at runTemplateHooks (template-extension.js:375)
at templateExtensionMasterHook (template-extension.js:324)
at template.js:116
at Function.Template._withTemplateInstanceFunc (template.js:437)
at fireCallbacks (template.js:112)
at null.<anonymous> (template.js:205)
at view.js:104
at Object.Blaze._withCurrentView (view.js:523)
at view.js:103

Any help will be appreciated


#3

I solved same issue doing that:

Make sure natestrauser:select2 comes before this package in your packages file, or make sure the library is loading before all templates that contain this form component.

Source: https://github.com/aldeed/meteor-autoform-select2/issues/15


#4

This is fantastic it worked! thanks!

@ricardodovalle Would you also happen to know why the select2 fields do not reset/clear like every other field generated by autoform?


#5

At now, I am looking for an example to solve that, I got the same issue. Sorry @adim86.
I was thinking to try selectize instead select2.


#6

@ricardodovalle Ah, ok I have that problem with all jquery plugins attached to autoform. I wil try and fix it, if I find a solution I will post it here


#7

@ricardodovalle Any luck trying to reset/clear the form after submitting? I have tried all sorts and it still is not working. i cannot even remove it using jquery (without removing it from the select options)