Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example of doing drop down input to the documentation #62

Open
keithn opened this issue Apr 13, 2015 · 5 comments
Open

Add example of doing drop down input to the documentation #62

keithn opened this issue Apr 13, 2015 · 5 comments

Comments

@keithn
Copy link

keithn commented Apr 13, 2015

Just playing with dropdowns. I'm just not sure how to bind the selection to the form? ie, I can change the selection, but the form doesn't know.

<template name="ddInput">
    <select class="reactive-element">
        {{#each values}}
        <option value="{{name}}">{{name}}</option>
        {{/each}}
    </select>
    <div>{{errorMessage}}</div>
</template>
{{> ddInput field='type' values=types}}

just a collection with {name:'something'}

 types: function() {
    return Values.find();
  }

and the Schema

type: {
        type: String,
        max: 5,
        instructions: "Select Type"
      }
@jonjamz
Copy link
Owner

jonjamz commented Apr 13, 2015

I have a really cool drop-down (and some other crazier elements) that I'll add to the docs update in their own section. The key here is to specify a validationValue method to get the selected item from the DOM. And if you want to use the schema to set the available options, you can use {{schema.allowedValues}} instead of {{values}}.

@jonjamz
Copy link
Owner

jonjamz commented Apr 13, 2015

Also check out #48, might be helpful.

@jbaack
Copy link

jbaack commented May 20, 2015

Like others, I am having issues with dropdowns - in my case a multi-select. Everything is working fine except I can't pull out the data. In
validationValue: function (el, clean, template) , el is an empty array when it is called on initial render. Not sure why. Also, I have tried a few different validation event types for this, including 'change', but none trigger validationValue when values are selected in the list.

It would be great to have the examples added to the documentation. Thanks for a great library.

@steph643
Copy link

I have no problem on my side. I use the 'change' event. Did you add the 'reactive-element' class to your 'select' tag?

@jbaack
Copy link

jbaack commented May 21, 2015

Thanks - yes, that was it. The other elements I added were OK - but missed it on that one and had been staring at it too long. Working as expected now - appreciate the help.

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

No branches or pull requests

4 participants