-
-
Save nakajima/69987 to your computer and use it in GitHub Desktop.
This file contains 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
$.fn.transitionToNext = function() { | |
({ | |
entry: function() { | |
// do whatever is needed to transition to entry | |
$(this).data('state.next', 'captcha'); | |
return false; | |
}, | |
captcha: function() { | |
$(this).removeClass('entry').addClass('captcha'); | |
$(this).data('state.next', 'fooblig'); | |
return false; | |
}, | |
final: function() { | |
$(this).disable(); | |
// not returning false, so the form should submit. | |
} | |
})[$(this).data('state.next')].call(this); | |
} | |
$('#new_user_form form').data('state.next', 'entry').bind('submit', function() { | |
$(this).transitionToNext(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment