BackboneForms different key than display possible?

55 Views Asked by At

I have a very simple form:

var UserForm = Backbone.Form.extend({
    template: _.template($('#formTemplate').html()),

    schema: {
        venue:      { validators: ['required'] },
    },
    model: this.model
});

This create a label with name Venue and puts a textfield beside it. But what if I want to name the label VenueName and keep the key it assigns to model venue. Is this possible? Thanks!

1

There are 1 best solutions below

0
On

From the documentation yes, this is very easy:

var UserForm = Backbone.Form.extend({
    template: _.template($('#formTemplate').html()),

    schema: {
        venue: {
            validators: ['required'],
            title: 'Venue Name'
        },
    },
    model: this.model
});