Created
February 1, 2021 16:54
-
-
Save mikeoberdick/35c9c2b53b21c9b6902278c3376eb5f1 to your computer and use it in GitHub Desktop.
Dynamically grab field values from Ninja Form fields on submit
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
<script> | |
var getQuoteFields = Marionette.Object.extend( { | |
initialize: function() { | |
this.listenTo( Backbone.Radio.channel( 'forms' ), 'submit:response', this.actionSubmit ); | |
}, | |
actionSubmit: function( response ) { | |
$sqFootage = response.data['fields'][15]['value']; | |
//Remove the hypens and replace with spaces | |
$county = response.data['fields'][10]['value'].replace(/-/g, " "); | |
jQuery('#squareFootage').text($sqFootage); | |
jQuery('#county').text($county); | |
console.log($county); | |
}, | |
}); | |
// Instantiate our custom field's controller, defined above. | |
new getQuoteFields(); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment