• Resolved patrickhealy

    (@patrickhealy)


    We are trying to prepopulate a few fields, both visible and hidden, with certain values that we would like passed through upon capture. There is a default value for these fields (i.e., general inquiry). We then have a utility that dynamically changes that via javascript depending on user behavior.

    If the visible field is left along and the hidden field would obviously be left alone the form acts as expected. It passes those values to our email.

    If the user behavior dictates that these two fields be changed by the utility they default values are still being passed – not the ones that were overwritten in the fields.

    In either case, if we manually update the visible field it passes as expected.

    Why, if the fields are not changed by the user but the utility do these values not pass through? This is the only one of the dozen forms we’ve tested that does this.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Contributor Kyle B. Johnson

    (@kbjohnson90)

    Hey Patrick,

    If you are updating the fields via JavaScript, then you will need to trigger a change event on the field after changing the value in the DOM. This causes the value to propagate to the model.

    Thread Starter patrickhealy

    (@patrickhealy)

    We are actually using a utility that does a find and replace, via JavaScript, to overwrite the default value. Ninja Forms is the only form out of the top 15 forms in wordpress that we’ve not be able to get working. Normally, we just populate the Default Value via regular keystrokes(ie.e, general inquiry) and the utility literally just finds and replaces the keystrokes just as a user would.

    Plugin Contributor Kyle B. Johnson

    (@kbjohnson90)

    My guess would be that the utility isn’t emulating user input exactly, and that there is a browser level difference on how this works, so a .change() event would need to be called on the field.

    Plugin Contributor Kyle B. Johnson

    (@kbjohnson90)

    Feel free to join the Developer Slack Team and we can dig deeper into this: developer.ninjaforms.com/slack

    My username is kjohnson. You can DM me.

    Thread Starter patrickhealy

    (@patrickhealy)

    Thanks for this.

    Question, why would the utility not work only with Ninja Forms and with all of the other dozen or so we tested? Does Ninja Forms handle default info differently then them?

    Plugin Contributor Kyle B. Johnson

    (@kbjohnson90)

    Ninja Forms THREE uses a JS framework to back the form display with a data model. This makes an application feel with inline validation, progressive parts, and conditionally hiding fields.

    Thread Starter patrickhealy

    (@patrickhealy)

    Isn’t that the way Gravity Forms works? Because we can pass those hidden, visible, with or without the option to pass query strings dynamically with our without Javascript/jQuery/etc. through Gravity Forms no problem

    • This reply was modified 8 years, 2 months ago by patrickhealy.
    Plugin Contributor Kyle B. Johnson

    (@kbjohnson90)

    I cannot speak to how another plugin works. I do not know.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘prepopulated hidden fields not passing correctly’ is closed to new replies.