Suppose you have a model like this:
Main.Models.LoginModel = EventQ.Model.extend({ defaults: { 'username': "", 'password': "" },
When your success in Ajax-Request, you can go to the next page. If this fails, you can set the model to undefined to indicate a missing value:
// assumed you did not enter your password this.me.model.set( { 'username': textBoxValueSoFar, 'password': undefined });
Then you can create such a template (it will be the same as when loading the first page):
<form> <input name="username" value="{{username}}" /> {{#unless username}} <label class="error">required</label> {{/unless}} <input name="password" value="{{password}}" /> {{#unless password}} <label class="error">required</label> {{/unless}} </form>
{{if}} checks if the value is not false, undefined, null, or []. Thus, when loading the first page, this is an empty line and no error message is provided.
For more information see http://handlebarsjs.com/ part with if).
So what you do: you use an empty string to indicate that so far no wrong value has been entered. You use undefined to check if an incorrect value has been entered (in fact, nothing). In your template, you can check this act accordingly.
source share