Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Forms 主干-Form.js-替换无线电编辑器模板_Forms_Backbone.js - Fatal编程技术网

Forms 主干-Form.js-替换无线电编辑器模板

Forms 主干-Form.js-替换无线电编辑器模板,forms,backbone.js,Forms,Backbone.js,使用Backbone-form.js的新手。我想知道如何使用模式中的模板选项替换Radio editor默认模板,如下所示 var altFieldTemplate = _.template('\ <ul>\ <% _.each(items, function(item) { %>\ <li>\ <input type="radio" name="<%= item.name %>

使用Backbone-form.js的新手。我想知道如何使用模式中的模板选项替换Radio editor默认模板,如下所示

var altFieldTemplate = _.template('\
        <ul>\
        <% _.each(items, function(item) { %>\
        <li>\
        <input type="radio" name="<%= item.name %>" value="<%= item.value %>" id="<%= item.id %>" />\
        <label for="<%= item.id %>"><%= item.label %></label>\
        </li>\
        <% }); %>\
        </ul>\
        ', null, Backbone.Form.templateSettings);

schema: {
        keyYesNo: { type: 'Radio', title: ' ', editorClass: 'radio-field', options: [{val: 'y', label: 'yes'}, {val: 'n', label: 'no'}],
            template: altFieldTemplate},
        },
var altFieldTemplate=\uu.template('\
    \ \
  • \ \ \
  • \ \
\ ,null,主干.Form.templateSettings); 模式:{ keyYesNo:{type:'Radio',title:'',editorClass:'Radio field',选项:[{val:'y',label:'yes'},{val:'n',label:'no'}], 模板:altFieldTemplate}, },
在我的示例中,我使用Radio editor的默认模板只是为了查看是否可以让它显示单选按钮而不出错。不幸的是,我得到了以下错误。。“ReferenceError:未定义项”