Created
October 11, 2019 20:29
-
-
Save kjohnson/79dfd4f28b4c0a1754631052cd47d386 to your computer and use it in GitHub Desktop.
Ninja Forms submit:response
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
<?php | |
/** | |
* Plugin Name: Ninja Forms Sandbox | |
*/ | |
add_action( 'wp_enqueue_scripts', function() { | |
wp_enqueue_script('ninja_forms_display_sandbox', plugin_dir_url(__FILE__) . 'script.js', ['nf-front-end'], time() ); | |
}); |
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
// Create a new object for custom validation of a custom field. | |
var mySubmitController = Marionette.Object.extend( { | |
initialize: function() { | |
console.log('Controller loaded'); | |
this.listenTo( Backbone.Radio.channel( 'forms' ), 'submit:response', this.actionSubmit ); | |
}, | |
actionSubmit: function( response ) { | |
console.log('Form Submitted'); | |
}, | |
}); | |
// On Document Ready... | |
jQuery( document ).ready( function( $ ) { | |
console.log('Document ready.'); | |
// Instantiate our custom field's controller, defined above. | |
new mySubmitController(); | |
}); | |
console.log('Script enqueued'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment