Skip to content

Instantly share code, notes, and snippets.

@nakajima
Forked from patmaddox/application.js
Created February 25, 2009 03:54
Show Gist options
  • Save nakajima/69987 to your computer and use it in GitHub Desktop.
Save nakajima/69987 to your computer and use it in GitHub Desktop.
$.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