vazco / meteor-universe-autoform-select

Meteor universe autoform select
MIT License
16 stars 10 forks source link

getting Error #20

Closed evanglerm closed 8 years ago

evanglerm commented 8 years ago

I get Exception in template helper: TypeError: AutoForm.getCurrentDataForForm is not a function.

I have defined Schema as follow.

  1. Registers.attachSchema(new SimpleSchema({ config: { type: Object }, 'config.name': { type: String, label: 'Register Name', autoform: { type: "universe-select", afFieldInput: { options: options, multiple: true } } }, ..... .....
  2. My Options is var options = function () { return Data.find().fetch(); };
  3. I get following exception. Exception in template helper: TypeError: AutoForm.getCurrentDataForForm is not a function at Object.AutoForm.addInputType.contextAdjust (http://localhost:3000/packages/vazco_universe-autoform-select.js?e437a520772d3de6db81a1708af9fabcf4d240cc:204:42) at Object.afFieldInputContext (http://localhost:3000/packages/aldeed_autoform.js?e1d69117d6547decd942b5ee534aaf2fa06cd951:6046:78) at http://localhost:3000/packages/blaze.js?9391df93ba5076c2cfc61ee68724eb79b65f00d9:2986:16 at http://localhost:3000/packages/blaze.js?
MichalW commented 8 years ago

What have you in Data? Options need format:

var options = [{label: 'label1', value: 'value1'},{label: 'label2', value: 'value2'}];
MichalW commented 8 years ago

What is your version of autoform?

evanglerm commented 8 years ago

I am using "aldeed:autoform 4.2.2" . Due to certin dependencies I am not able to upgrade to higher version.

 Data = new Mongo.Collection("data");
// I have tried it with following as well 
Registers = new Mongo.Collection("registers");

I have also taken you simple example which return static options but even that gives the same error.

MichalW commented 8 years ago

fixed

evanglerm commented 8 years ago

Still getting same error. LIttle bit out of this issue. I am generating Schema dynamically. I can see those Autoforms as well dynamically. I want to add Autosuggest and tried "mizzao/meteor-autocomplete". That works ok except for the thing that it needs "template: Template.userPill". Since my stuff is dynamic, if you can give clue/hint/help in creating template like

<template name="userPill">
    <span class="label">{{*I want to give Autoform Property while creating the Schema Dynamically*}}</span>
</template>

In short I want to create HTML Template from scratch in JS, which is available for rendering when I load my Autoform page. Appreciate any clue/hint/help.

Coming back to the issue here are the details.

  1. Trace different than Before.
debug.js:41 TypeError: AutoForm.getCurrentDataForForm is not a function
    at null.<anonymous> (universe-autoform-select.js:125)
    at template.js:116
    at Function.Template._withTemplateInstanceFunc (template.js:457)
    at fireCallbacks (template.js:112)
    at null.<anonymous> (template.js:205)
    at view.js:107
    at Object.Blaze._withCurrentView (view.js:538)
    at view.js:106
    at Object.Tracker._runFlush (tracker.js:497)
    at onGlobalMessage (setimmediate.js:102)
  1. My Options
var options = function () {

    return options = [{label: 'label1', value: 'value1'},{label: 'label2', value: 'value2'}];;
};
MichalW commented 8 years ago

Please try now with version 0.1.18

evanglerm commented 8 years ago

I does create dropdown but up-down arrow keys are not working. Not sure if it is because I am trying with Autoform-Ionic combination. That is the package which doesnt allow me to upgrade to Autoform5 as well.

MichalW commented 8 years ago

arrow keys are not implemented yet: https://github.com/vazco/meteor-universe-autoform-select/issues/19