3

I am following this fiddle http://jsfiddle.net/evilcelery/4XZMb/

$(function() {
    //Use BootstrapModal for object List editor
    Backbone.Form.editors.List.Modal.ModalAdapter = Backbone.BootstrapModal;

    //Main model definition
    var User = Backbone.Model.extend({
        schema: {
            title:      { type: 'Select', options: ['', 'Mr', 'Mrs', 'Ms'] },
            name:       'Text',
            email:      { validators: ['required', 'email'] },
            birthday:   'Date',
            password:   'Password',
            notes:      { type: 'List' },
            weapons:    { type: 'List', itemType: 'Object', subSchema: {
                name: { validators: ['required'] },
                number: 'Number'
            }}
        }
    });

    var user = new User({
        title: 'Mr',
        name: 'Sterling Archer',
        email: 'sterling@isis.com',
        birthday: new Date(1978, 6, 12),
        password: 'dangerzone',
        notes: [
            'Buy new turtleneck',
            'Call Woodhouse',
            'Buy booze'
        ],
        weapons: [
            { name: 'Uzi', number: 2 },
            { name: 'Shotgun', number: 1 }
        ]
    });

    //The form
    var form = new Backbone.Form({
        model: user
    }).render();

    //Add it to the page
    $('body').append(form.el);
});

for my application. But however I am not able to view the Modal dialog view on clicking of the "Weapon" list. It shows properly in the fiddle, but when I try to do the same thing in my application, it does not include the modal dialog in my view. Can some one help me in this? Is there any special event handler required to add the Modal dialog view in my application?

Sudo
  • 559
  • 1
  • 8
  • 15
  • 1
    Did you include the backbone bootstrap model js file as shown in the documentation. Creates a list of items that can be added, removed and edited. Used to manage arrays of data. This is a special editor which is in a separate file and must be included: https://github.com/powmedia/backbone-forms#editor-list – prashanth Jan 04 '13 at 23:36
  • If using the Object or NestedModel listType, you will need to include a modal adapter on the page. Backbone.BootstrapModal is provided for this purpose. It must be included on the page: – prashanth Jan 04 '13 at 23:38
  • Yes.. I did add it... its replica of what you can see in the jsfiddle. but it doesnt work in my case somehow.. – Sudo Jan 07 '13 at 22:00
  • I know this is old, but I think the solution might be that the you need to also include bootstrap.min.js, which is checked in JSFiddle env. Not 100% sure though. – Brenwell Jul 17 '14 at 11:00

0 Answers0