Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Error: Syntax error, unrecognized expression: [name=property.rid] #248

Open
ghost opened this issue Oct 16, 2014 · 1 comment
Open

Comments

@ghost
Copy link

ghost commented Oct 16, 2014

Good morning everyone,
I can not perform the validation of a NestedModel because of the error you find as title.
I use https://github.com/afeld/backbone-nested for nested Model.
I use https://github.com/tbranyen/backbone.layoutmanager for Nested Views.

Here is my model:

define([
'jquery',
'backbone'
], function ($, Backbone) {

'use strict';
return Backbone.NestedModel.extend({
    urlRoot: '/matches',
    validation: {
        'property.rid' : {
            pattern : 'email'
        }
    },
    idAttribute: "rid"
});

});

In my view I go:

define([
...
], function ($, Backbone, Property, ... template) {

'use strict';
return Backbone.View.extend({
    initialize: function (options) {
...
        this.model = new Model();
        Backbone.Validation.bind(this);
    },
    template: _.template(template),
    afterRender: function () {
        var self = this;
        //For Validation
        //this.stickit();

...
},

    saveModel: function (e) {
        e.preventDefault();
        var values = this.$form.serializeObject();
        values.property = new Property({
          rid : values.property
        }).attributes;
       this.model.set(values);
        console.log(this.model.attributes)
        if (this.model.isValid(true)) {
           //Lock Form
            this.lockForm();
                       this.model.save(null, {
             success: _.bind(this.onSaveModelSuccess, this),
             error: _.bind(this.onSaveModelError, this)
             });        
        }
    },

....

Does somebody have some clue about my error?

Your help is really appreciated. Best Regards

@chiefGui
Copy link
Collaborator

chiefGui commented Feb 2, 2015

Please, update your Backbone.Validation to our latest version, v0.11.1. A fix is attached. 👍

I won't close this by now — will be waiting for your feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant