Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Doesn't work for multiple inputs #229

Closed
lodenrogue opened this issue Jun 18, 2016 · 7 comments
Closed

Doesn't work for multiple inputs #229

lodenrogue opened this issue Jun 18, 2016 · 7 comments
Assignees

Comments

@lodenrogue
Copy link

I created a start address and end address input and gave them both the same class. I referenced the class in places -> container but the functionality only works for the first input not the second.

Please take a look at the source code if you have any questions: http://pastebin.com/huQx5X1F

@vvo
Copy link
Contributor

vvo commented Jun 19, 2016

Hi @lodenrogue, for now you need to instantiate it twice: one per input. I will make this clearer

@redox
Copy link
Contributor

redox commented Jun 19, 2016

Hi @lodenrogue, for now you need to instantiate it twice: one per input. I will make this clearer

autocomplete.js is compliant with multiple inputs binding; we should be able to support it.

@lodenrogue
Copy link
Author

Ok thanks.

@vvo
Copy link
Contributor

vvo commented Jun 20, 2016

This is different here I believe because you would want different events given the start or end inputs, thus getting a single instance of places.js when bound on different inputs does not make sense in this use case.

@redox
Copy link
Contributor

redox commented Jun 20, 2016

This is different here I believe because you would want different events given the start or end inputs, thus getting a single instance of places.js when bound on different inputs does not make sense.

Right; eventually we should be able to rely on the underlying target of the event. But makes sense.

@vvo
Copy link
Contributor

vvo commented Jun 20, 2016

@lodenrogue you can do this:

var start = places({container: document.querySelector('#start-input')});
var end = places({container: document.querySelector('#end-input')});

Given that your html looks like this:

<input type="text" id="start-input">
<input type="text" id="end-input">

vvo pushed a commit that referenced this issue Jun 20, 2016
## [1.0.2](v1.0.1...v1.0.2) (2016-06-20)

### Bug Fixes

* **errors:** precise error messages on some bad usage ([dc8f0e1](dc8f0e1)), closes [#229](#229)
* **inputValue:** when name is a country, there should be no comma (#234) ([5e56c39](5e56c39))
* **src:** Fix ESLint configuration issue under /src/ for #231 (#232) ([0a60d4c](0a60d4c)), closes [#231](#231) [#232](#232)
* **website:** fix json response, thanks [@dzello](https:/dzello) for the heads up ([de9d87f](de9d87f))
@lodenrogue
Copy link
Author

Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants