Skip to content

Instantly share code, notes, and snippets.

@kjohnson
Created October 11, 2019 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kjohnson/79dfd4f28b4c0a1754631052cd47d386 to your computer and use it in GitHub Desktop.
Save kjohnson/79dfd4f28b4c0a1754631052cd47d386 to your computer and use it in GitHub Desktop.
Ninja Forms submit:response
<?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() );
});
// 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