From e716b86ac967c2428d547025cd21ef3dae453d9d Mon Sep 17 00:00:00 2001 From: Tim Griesser Date: Mon, 21 Jan 2013 14:17:23 -0500 Subject: [PATCH] documenting validationError --- backbone.js | 3 +++ index.html | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/backbone.js b/backbone.js index 545b4447..2f08d9c0 100644 --- a/backbone.js +++ b/backbone.js @@ -252,6 +252,9 @@ // A hash of attributes whose current and previous value differ. changed: null, + // The value returned during the last failed validation. + validationError: null, + // The default name for the JSON `id` attribute is `"id"`. MongoDB and // CouchDB users may want to set this to `"_id"`. idAttribute: 'id', diff --git a/index.html b/index.html index f913a99a..9eb6a291 100644 --- a/index.html +++ b/index.html @@ -334,6 +334,7 @@
  • save
  • destroy
  • validate
  • +
  • validationError
  • url
  • urlRoot
  • parse
  • @@ -1283,7 +1284,9 @@ book.destroy({success: function(model, response) { error object that describes the error programmatically. If validate returns an error, set and save will not continue, and the model attributes will not be modified. - Failed validations trigger an "invalid" event. + Failed validations trigger an "invalid" event, and set the + validationError property on the model with the value returned by + this method.

    @@ -1314,6 +1317,12 @@ one.save({
           messages at the model or collection level.
         

    +

    + validationErrormodel.validationError +
    + The value returned by validate during the last failed validation. +

    +

    urlmodel.url()