Wishmitha S. Mendis
Wishmitha S. Mendis

Reputation: 127

Value of the selected option is not saved in the collection aldeed:autoform-select2 Meteor

I created a field of a schema (CollectionTest) as follows.

year: {
        type: String,
        label: "Year",
        autoform:{
            type:'select2',
            options:function () {

                return[{label:"2013",value:3102},{label:"2014",value:4102},{label:"2015",value:5102}]

            }
        }
    }

When I submit the autoform, it is inserted to the collection. But regardless of the selected option of the year, the year field is always saved as "2013" (which is not even a value).

collectionTest 
{
"_id" : "iysowN69pKWJeajDa",
"year" : "2013"
}

But when I change the 'select2' to 'select' it works fine. But I need to implement the 'select2' because the year field should be searchable.

And I imported following packages before implementing select2 field.

aldeed:autoform-select2
natestrauser:select2

Upvotes: 0

Views: 106

Answers (1)

blueren
blueren

Reputation: 2860

I don't know about select2, but would you be interested in giving selectize a try?

I currently have these three packages installed and they all work fine.

chhib:selectize-bootstrap-3 
vazco:universe-selectize
comerc:autoform-selectize. 

Your Simple-schema format mostly remains the same except you replace 'select2' with 'selectize'

Upvotes: 1

Related Questions