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

Setting default value #9

Open
arvi opened this issue Mar 11, 2015 · 3 comments
Open

Setting default value #9

arvi opened this issue Mar 11, 2015 · 3 comments

Comments

@arvi
Copy link

arvi commented Mar 11, 2015

Do you have an example on how to set a selectize-input field value to a default value. I'm trying to implement usual autoform default value rendering. It works in typeahead and normal input but not in selectize.

Here's an example of a time displaying in typeahead input(From Time), but not displaying in selectize input (To Time).
screen shot 2015-03-11 at 12 47 42 pm

Here's my code:
events.html

{{> afQuickField name='from_time' value=eventStartTime template="bootstrap3-horizontal" label-class="col-sm-3" input-col-class="col-sm-9"}}

{{> afQuickField name='to_time' value=eventEndTime template="bootstrap3-horizontal" label-class="col-sm-3" input-col-class="col-sm-9"}}
.....

events.js

Template.Events.helpers({
    eventStartTime: function () {
        return Session.get('eventStartTime');
    },
    eventEndTime: function () {
        return Session.get('eventEndTime');
    },
   .....
});

collection-schemas.html

.....
to_time: {
      type: String,
      optional: true,
      label: 'To Time',
      autoform: {
        type: "selectize",
        firstOption: 'Select or input a time',
        options: function () {
          return [
            {label: '06:00 AM', value: "06:00"},
            {label: '06:30 AM', value: "06:30"},
            {label: '07:00 AM', value: "07:00"},
            .....
          ];
        }
      }
    },
@chneau
Copy link

chneau commented Oct 1, 2015

Same question here !

    autoform:
      type: "selectize"
      afFieldInput:
        selectizeOptions:
          valueField:'value'
          labelField:'text'
          searchField:'text'
          preload: true
          load:(q,c)->c(Things.find().fetch().map((doc)->{text:doc.name,value:doc._id}))

It's for a field that is not multiple, and still not working with items and options with multiple.
Is the thing only suitable for inserting ? Because on "update" autoform, it doesn't get the actual value at all.

@ayhid
Copy link

ayhid commented Apr 27, 2016

has anyone found a solution for this issue? There is no way to get the selected values to display on an edit form

@saifks
Copy link

saifks commented May 6, 2016

You have to provide the options attribute to autoform then only it will display

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

No branches or pull requests

4 participants