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

Autoform afQuickField not working well with type="select2" and multiple=true.

Open
#78 2 comments 3 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

Hi,

I am using `afQuickField` with `type="select2"` and `multiple=true`.
#### html:-
`{{> afQuickField name="Country" type="select2" multiple=true select2Options=s2Opts options=optionsCountry }}`

#### js:-
```
s2Opts(){
return {
placeholder: "select upto 8 county",
tags: true
};
},

optionsCountry(){
return [{
label:"India"
value:"india"
},{
label:"North America"
value:"north-america"
},{
label:"South Africa"
value:"south-africa"
},{
label:"China"
value:"china"
},{
label:"Nepal"
value:"nepal"
},{
label:"Shri Lanka"
value:"shri-lanka"
},{
label:"Malesiya"
value:"malesiya"
},{
label:"Afghanistan"
value:"afghanistan"
},{
label:"Canada"
value:"canada"
},{
label:"France"
value:"france"
}];
}

```
#### Schema :-
```
Country: {
type: [String],
optional: true,
maxCount: 8,
autoform: {
label: "Country"
}
},
```

When we select 3 or more countries and click on update button.

### Current Result:-
- It shows only one selected Country which is top in the list among selected Countries.

![Select country](https://user-images.githubusercontent.com/29011434/30479645-c8d2f56c-9a33-11e7-9367-f09ec490b100.gif)

### Expected Result:-
- It should show all 3 selected Countries after click on update button.

Please advise.

Thanks and Regards,
Saransh

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 reported afQuickField setup with type="select2", multiple=true, select2Options, and the array schema shown in the issue. Trace how the selected values are restored after clicking Update. Done means all selected countries, not only the first, remain selected after the form is updated.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.