Created
August 23, 2016 13:54
-
-
Save kjohnson/e6dcd0ba5b3f56217144b61cc51c0e5f 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
var myCustomController = Marionette.Object.extend({ | |
initialize: function() { | |
// ... | |
Backbone.Radio.channel( 'form-' + formID ).reply( 'maybe:submit', this.beforeSubmit, this, formID ); | |
}, | |
beforeSubmit: function( formID ) { | |
var formModel = nfRadio.channel( 'app' ).request( 'get:form', formID ); | |
if( formModel.getExtra( 'my_restart_flag' ) ) return true; | |
this.otherProcessing( formModel ); | |
// Halt form submission. | |
return false; | |
}, | |
otherProcessing: function( formModel ) { | |
// Set re-start flag | |
nfRadio.channel( 'form-' + this.formModel.get( 'id' ) ).request( 'add:extra', 'my_restart_flag', true ); | |
// Re-start submission. | |
nfRadio.channel( 'form-' + formModel.get( 'id' ) ).request( 'submit', formModel ); | |
}, | |
}); | |
jQuery( document ).ready( function( $ ) { | |
new myCustomController(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for your work!
The above JS didn't work for me.
The updated code below did.