• Resolved shagdirty

    (@shagdirty)


    When I log ‘form’ in console it’s ALWAYS the same form regardless of page or even if I’ve submitted a different form. Why would that be? for instance I’m on a page and the form on that page has an ID of 6 but console.log(form) still outputs information for form ID 4.

    when I run (in functions.php):

    var mySubmitController = Marionette.Object.extend( {
    initialize: function() {
    this.listenTo( Backbone.Radio.channel( 'forms' ), 'submit:response', this.actionSubmit );
    },
    
    actionSubmit: function( response ) {
    console.log('Form ID: ' + form.id); 
    },
    });

    It’s always coming up with form ID of 4 and all the data associated with that form even though I just submitted a form with an ID of 6.

    Also, I can just run console.log(form) on ANY page (even if there’s not a form on it that also returns form ID 4.

    Ultimately, I’m trying to get the submission ID passed to the form’s redirect page but not having any luck and I suspect this could be a related issue.

    Thoughts?

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter shagdirty

    (@shagdirty)

    Still haven’t figured this out but accomplished what I needed which was to get the submission ID for the current form. See this post regarding that: https://www.ads-software.com/support/topic/passing-submission-id-to-redirect-page/

    I CAN get the correct form data on submit using the code below but I still get the wrong form ID when I run log on ‘form’ for some reason.

    (in my theme’s custom js file…)

    var mySubmitController = Marionette.Object.extend( {
      initialize: function() {
        this.listenTo( Backbone.Radio.channel( 'forms' ), 'submit:response', this.actionSubmit );
      },
    
      actionSubmit: function( response ) {
        console.log(response);
      },
    });
    
    jQuery( document ).ready( function( $ ) {
        // Instantiate our custom field's controller, defined above.
        new mySubmitController();
    });

    I’ll leave this open for a bit in hopes that someone can tell me why this works and console.log(form) doesn’t.

    Plugin Contributor Justin McElhaney

    (@jmcelhaney)

    You might want to ask about this issue on our Ninja Forms Developer Community Slack Channel. https://developer.ninjaforms.com/slack/

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Ninja Forms Always Logging Same Form ID’ is closed to new replies.