小编dsc*_*dsc的帖子

Meteor-AutoForm:如何根据另一个控件更新选择选项

我一直在搜索SO问题,以寻找一些非常简单的答案,但对于我的生活,我无法弄明白.

基本上我有一个带有两个选择控件的meteor-autoform:

<template name="processFormTemplate">
    {{#autoForm id="processForm" collection="Processes" type=formAction doc=doc validation="blur"}}
        <div class="col-md-12">
            {{> afQuickField name="elementId" options=elements}}
            {{> afQuickField name="categoryId" options=categories}}
            {{> afQuickField name="title"}}
            {{> afQuickField name="desc" rows=4}}
        </div>
        {{>formButtons}}
    {{/autoForm}}
</template>
Run Code Online (Sandbox Code Playgroud)

然后这些有助手填充选项:

Template.processFormTemplate.helpers({
  elements: function() {
    return getFormElements();
  },
  categories: function(elementId) {
    return getFormCategories(this.doc.elementId);
  }
});
Run Code Online (Sandbox Code Playgroud)

LIB/methods.js

 getFormElements = function() {

        var options = [];

    Elements.find({}, {sort: {ref:1}}).forEach(function (element) {
                    options.push({
                        label: element.title, value: element._id
                    });
                });

    return options;

};

getFormCategories = function(elementId) {

    var options = [];
    var filter …
Run Code Online (Sandbox Code Playgroud)

javascript meteor meteor-autoform

5
推荐指数
2
解决办法
5816
查看次数

扩展Braintree托管字段 - Paypal和CC类型

我的托管字段在我的沙盒环境中工作正常,但我想知道如何模仿drop-in UI的两个功能,即:

  1. 显示信用卡类型的图标.我可以根据事件触发(根据文档)在控制台中记录类型,但想知道是否有一种简单的方法来显示内嵌的卡片图像?
  2. 集成贝宝按钮?查看托管字段选项,不支持paypal,所以我的猜测是我需要设置第二个连接类型为"paypal"并传入容器,但这似乎效率很低.

我试过了:

braintree.setup(token, "custom", {
  id: "options",
  paypal: {
    container: "paypal-button"
  },
/* hosted fields stuff */
});
Run Code Online (Sandbox Code Playgroud)

..但是没有做任何事情.

如果英国电信的任何人都可以指导我这两个问题,我将不胜感激.

谢谢,
大卫

javascript paypal braintree meteor

3
推荐指数
1
解决办法
3002
查看次数

标签 统计

javascript ×2

meteor ×2

braintree ×1

meteor-autoform ×1

paypal ×1