-
-
Save kjohnson/9c6f6764bdb8c45c15b1db391afcc365 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
// Create a new object for custom validation of a custom field. | |
var myCustomFieldController = Marionette.Object.extend( { | |
initialize: function() { | |
// Listen to the render:view event for a field type. Example: Textbox field. | |
this.listenTo( nfRadio.channel( 'textbox' ), 'render:view', this.renderView ); | |
}, | |
renderView: function( view ) { | |
// Check if this is the right field. Example check for field key. | |
if ( 'example_key' != view.model.get( 'key' ) ) return false; | |
var el = jQuery( view.el ).find( '.nf-element' ); | |
// Do stuff. | |
} | |
}); | |
// On Document Ready... | |
jQuery( document ).ready( function( $ ) { | |
// Instantiate our custom field's controller, defined above. | |
new myCustomFieldController(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment