Hi,
just wondering if anyone has ideas how to approach the following view pattern.
A small form is used for validating the existence of data. For example, if a certain address / credit card no / ... is allowed.
So, I have two views:
* Input view: (validator)
* Result view
And one model:
* Account
Now, I wonder how I could wire up the result of the validation. So far, I have:
define([
'view',
'models/account',
'views/accounts/show',
'hbs!templates/accounts/valid'
], function (View, Account, ShowView, template) {
return View.extend({
name: 'accounts/valid',
template: template,
events: {
'submit': 'validate'
},
validate: function(ev) {
ev.preventDefault();
var address = $("input[name='address']").val();
var account = new Account({address: address });
var show = new ShowView({model: account, el: $("#result")});
show.render();
}
});
});
But somehow, the way to render the result of the validation should be managed by events. or?
Sorry if sounding confusing, probably, I am too tired, and should stop hacking :)
Thanks for feedback anyway,
Patrick