Skip to content

Instantly share code, notes, and snippets.

@SeonghoonKim
Created September 4, 2012 04:26
Show Gist options
  • Save SeonghoonKim/3616578 to your computer and use it in GitHub Desktop.
Save SeonghoonKim/3616578 to your computer and use it in GitHub Desktop.
Marionette View에서 jquery.validate 사용
var XyzView = Marionette.ItemView.extend({
template : '#xyz-tpl',
ui : {
form : 'form'
},
events : {
'click button.action' : 'onActionRequested',
'submit' : 'onActionRequested'
},
onRender : function() {
this.ui.form.validate();
},
onActionRequested : function(event) {
event.preventDefault();
if (!this.ui.form.valid()) {
this.ui.form.validate().focusInvalid();
return false;
}
// ...
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment