Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>From the docs: <a href="http://backbonejs.org/#Model-validate" rel="nofollow">http://backbonejs.org/#Model-validate</a>:</p> <blockquote> <p><code>isValidmodel.isValid()</code></p> <p>Models may enter an invalid state if you make changes to them silently ... useful when dealing with form input. Call <code>model.isValid()</code> to check if the model is currently in a valid state, according to your validate function.</p> </blockquote> <p>also from <a href="https://github.com/thedersen/backbone.validation#what-gets-validated-when" rel="nofollow">https://github.com/thedersen/backbone.validation#what-gets-validated-when</a></p> <blockquote> <p>What gets validated when?</p> <p>If you are using Backbone v0.9.1 or later, all attributes in a model will be validated. However, if for instance name never has been set (either explicitly or with a default value) that attribute will not be validated before it gets set.</p> <p>This is very useful when validating forms as they are populated, since you don't want to alert the user about errors in input not yet entered.</p> <p>If you need to validate entire model (both attributes that has been set or not) you can call <code>validate()</code> or <code>isValid(true)</code> on the model.</p> </blockquote> <p>The Backbone-Forms docs specifically mention model.validate:</p> <p><a href="https://github.com/powmedia/backbone-forms#model-validation" rel="nofollow">https://github.com/powmedia/backbone-forms#model-validation</a></p> <p>You could easily hook model.Validate up to whatever edit events or click events you want.</p> <p>Also, you might find this useful (not sure if it is compatible with Backbone.Forms though):</p> <p><a href="https://github.com/thedersen/backbone.validation" rel="nofollow">https://github.com/thedersen/backbone.validation</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload