Created
          September 4, 2012 04:26 
        
      - 
      
- 
        Save SeonghoonKim/3616578 to your computer and use it in GitHub Desktop. 
    Marionette View에서 jquery.validate 사용
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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