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

Validation of NestedModels in List jquery-ui-editors #63

Closed
cthurston opened this issue May 18, 2012 · 2 comments
Closed

Validation of NestedModels in List jquery-ui-editors #63

cthurston opened this issue May 18, 2012 · 2 comments

Comments

@cthurston
Copy link

It seems that the nested models are not being "committed" from the List modal. This means that if the schema does not contain validation but the model does, the nested modal will be saved to the main model even though it is not valid (on the model).

Seems like an easy enough fix, we just force the embedded model to commit. Near line 392 in jquery-ui-editors:
var saveAndClose = function() {
var errs = editor.validate();
if (errs) return;

    //validate against the model too
    if(listType == "NestedModel"){
        errs = editor.commit();
        if (errs) return;
    }

However, the NestedModel editor has this line in its commit function near line 1500 in backbone-forms.js. This will kick an error from the modal.

return editors.Object.prototype.commit.call(this);

Any ideas on how to insure the List jquery-ui-editor for NestedModels will validate against the model?

@powmedia
Copy link
Owner

I'm almost done writing a completely revamped List editor so any further development will go into that, but if you can create a fix and a pull request I'll merge that. The List editor itself isn't properly tested at the moment but as long as all the other tests are passing it should be good to do.

You can run the tests by opening test/index.html in a browser. Let me know if you have any more questions, thanks

@powmedia
Copy link
Owner

powmedia commented Jun 1, 2012

The old jQueryUI List editor is now deprecated, see the new List editor

@powmedia powmedia closed this as completed Jun 1, 2012
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

2 participants