I'm trying to validate a form within a view when it is displayed. But the onActive event is triggered before the view has been attached to the page.
Ideally I'd like to do something like this.
'click #step1': {
view: _.template($('.template-step1').html()),
onActive: function() {
this.$el.find('.js-register-form').validate();
}
}
But I've had to do something like this.
'click #step1': {
view: function() {
var $view = _.template($('.template-step1').html());
$view.find('.js-register-form').validate();
return $view;
}
}