Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7004967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:16:03+00:00 2026-05-27T21:16:03+00:00

Using the following as an example: var Case = Backbone.Model.extend({ initialize: function(){ this.bind(error, function(model,

  • 0

Using the following as an example:

var Case = Backbone.Model.extend({

  initialize: function(){

    this.bind("error", function(model, error){
        console.log(error)
      });
    },

  url: function() { 
    return '/api/kase?id=' + this.get("id"); 
  },

  validate: function(attrs) {

    return "An error";  



  }
});

In this case the validate method does not get called:

var kase = new Case();
kase.save();

In this case the validate method does not get called either:

var kase = new Case({subject: null});
kase.save();

In this case the validate method does get called, but the POST request is still made on save:

var kase = new Case();
kase.set("subject",null);
// An error
kase.save();
// POST http://localhost.local/api/kase?id=undefined 404 (Not Found)

Is this the expected behaviour? Am I missing something with regard to ‘cancelling’ the POST/PUT request when client side validation fails? Or should I be checking for a valid model before hitting the save method? (think the penny may have just dropped).

Any guidance would be most appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:16:03+00:00Added an answer on May 27, 2026 at 9:16 pm

    A set that fails won’t update the model data while a call to save without parameters will post/put the current state of the model to the server (empty in your case). On the other hand, if you call your save method with the data to be validated, it will stop if the validation fails:

     var kase = new Case();
     kase.save({subject:null});
    

    should log an error and stop before posting to the server.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the following example I get title from this form using html id=title .
I'm using jquery.hotkeys.js and mapping my keybinding in the following fashion: $(document).bind('keydown', 'i', function()
I'm trying to access $a using the following example: df<-data.frame(a=c(x,x,y,y),b=c(1,2,3,4)) > df a b
Given the following example (using JUnit with Hamcrest matchers): Map<String, Class<? extends Serializable>> expected
I was trying the following example, but with external URLs: Using WebViews The example
I have tried using the obvious method as outlined in the following example but
I am using the following html page: <html> <head> <title>AJAX Example</title> <meta http-equiv=Content-Type content=text/html;
Please forgive the verbosity of the following code example. Using Delphi 2009, I created
For example, if I'm doing some form input validation and I'm using the following
I'm following the racetrack example from Jason Rudolph's book at InfoQ , using grails-1.2.1.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.