Meteor-Community-Packages / Meteor-Community-Packages/meteor-autoform-select2

Value of the selected option is not saved in the collection.

Open
#73 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

hacktoberfest
Dominant language
JavaScript
Stars
25
Forks
27
PR merge metrics
No merged PRs in 30d

Description

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
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the schema with the `select2` and `select` input types using the `aldeed:autoform-select2` and `natestrauser:select2` packages. Trace how the selected option is passed from the searchable input into AutoForm submission. Done means the selected option's value, rather than its label, is saved in the collection.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.