• Resolved riostack

    (@riostack)


    Hello,

    I’m reaching out for assistance with an issue we’re seeing in Forminator.

    We have hidden fields created on the forms as Custom Values. We are correctly injecting the hidden values via JavaScript, and these values are displaying correctly in the HTML hidden field values way before the form is submitted.

    However, upon submission, these hidden field values are not passing through to the Forminator side under Submissions.

    Is there anything I might be missing or any configuration settings that need to be checked?

    Thank you for your help!

    Best,

    Brandon

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

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @riostack

    I hope you are doing well.

    I checked the shared form but none of the hidden fields has a value:

    https://monosnap.com/file/eBvdnhoAI3F5yKrpIJul2cQ6ZH1J1W

    Since you said it works when you add the HTML field could you share the code that you are using and we can have a look?

    Note, we can’t provide custom coding but we can look into why it is not working and see if we can guide you in the correct direction.

    I believe it is related to a security matter that we can’t inject the code dynamically other than using the query strings https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#default-value

    Best Regards
    Patrick Freitas

    Thread Starter riostack

    (@riostack)

    Hi @wpmudevsupport12

    The hidden fields are being populated when users interact with the forms, not on page load. We’re injecting the hidden fields based on query parameters, with additional logic for cases where query parameters aren’t present in the URL. So, using the “query” type alone isn’t sufficient for our needs.

    I’ve selected the “Custom Value” hidden field type in the form editor, which should give us the control we need to populate the values. The issue isn’t that the hidden fields aren’t being populated – if you interact with the form and check the console/HTML values, you’ll see the code injection is working correctly for all hidden fields.

    The problem seems to be with Forminator not picking up these values, even though the hidden fields are properly shown in the HTML code before the form is submitted. It appears there’s a limitation in how Forminator is handling these values during the submission process, as the hidden field data isn’t being posted to Forminator.

    Could it be that the code needs to trigger a change event, or do you have any other thoughts on what might be causing this?

    Thanks,
    Brandon

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @riostack

    I can see only 2 hidden fields that have value when submitting the form, and the payload shows those data have been sent to admin so they should be saved, can you please confirm if you are receiving those fields?

    View post on imgur.com

    I’m not sure how your code prefills the form hidden fields but we recommend using the built-in method as it may not be possible to auto-fill the fields using Javascript.

    We do have a feature request for allowing to prefill hidden fields with custom fields but I don’t have an ETA about when its going to be implemented.

    Best Regards
    Amin

    Thread Starter riostack

    (@riostack)

    Hi @wpmudev-support2

    That looks correct, as the testing link I shared only had the GCLID field pre-filled in the URL, which matches your screenshot. I didn’t see any submission with the email “[email protected]” in the Forminator submissions, so I wasn’t able to verify if the GCLID field came through with your test submission.

    Here’s what I’m seeing on my end:

    Payload Data: https://imgur.com/XuvlrkU

    Forminator Submission: https://imgur.com/t92fVVr

    Is there any reason why the GCLID value isn’t showing up on the Forminator side even though it’s correctly displaying in the Payload data?

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @riostack

    I believe the issue lies behind how we validate the data in server-side code (PHP codes) and due to security reasons we don’t allow you to inject data into form fields.

    I asked our development team to review your issue, in the meantime could please let us know where can we see your Javascript code or share it here with us to take a closer look?

    We will get back to you once have further information about this case.

    Best Regards,
    Amin

    Thread Starter riostack

    (@riostack)

    Hi @wpmudev-support2

    I’d prefer to keep the code and injection method private. However, as we’ve confirmed the injection is working and the data is being sent via the payload, the issue seems to lie in how Forminator is handling the fields as you mentioned.

    Is there anything additional that needs to be done to ensure the data passes the server-side validation and security checks? I’ve worked with similar form providers and JS code injection should be a common feature.

    To clarify, the default field types provided by Forminator alone don’t meet our requirements – specifically, the “query” field type alone isn’t sufficient for our needs.

    Please let me know what you find out about why the payload data is being rejected by the system. Are you getting any errors messages on your system when these hidden fields are sent via the payload?

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @riostack

    Thank you for sharing more information, We got further feedback from our development team.

    I’m afraid that it is impossible to manipulate the data on the client side (browser) using Javascript only because as I mentioned, we do some validations on the server level (PHP) before saving the data into the database, so you will need code on PHP to make it work.

    If you have the knowledge you can look for forminator_custom_form_submit_before_set_fields hook in the plugin files and modify the form data before it is saved into the database to recognize your custom hidden values added by Javascript.

    Unfortunately, this will be outside the scope of support we can provide. For that, you’ll need to hire a developer to provide the required custom code for you. WordPress provides a jobs directory here https://jobs.wordpress.net/, if you need further advice about it, feel free to email [email protected].

    Subject: ATTN: WPMU DEV support – wp.org”

    Kind Regards
    Amin

    Thread Starter riostack

    (@riostack)

    Hi @wpmudev-support2

    I appreciate this. Just wanted to clarify if the forminator_custom_form_submit_before_set_fields hook is available in all versions of Forminator or if it’s version-specific?

    Plugin Support Saurabh – WPMU DEV Support

    (@wpmudev-support7)

    Hello @riostack

    Hope you’re doing well today!

    The hook forminator_custom_form_submit_before_set_fields is not version-specific, however, I have pinged the devs to confirm if it has been available in all the versions of Forminator. We will update you here as soon as we get further information about it.

    Also, here is a list of hooks that were deprecated after the v1.16 https://wpmudev.com/docs/api-plugin-development/forminator-api-docs/#modified-or-deprecated-hooks

    Kind Regards,
    Saurabh

    Plugin Support Saurabh – WPMU DEV Support

    (@wpmudev-support7)

    Hello @riostack

    That was a quick update from the devs, they were able to confirm that the hook forminator_custom_form_submit_before_set_fields is not version-specific and available in all Forminator versions.

    Hope this information helps.

    Kind Regards,
    Saurabh

    Thread Starter riostack

    (@riostack)

    Thank you. I confirmed the hook (forminator_custom_form_submit_before_set_fields) is present on the plugin file. However, we found a different workaround to get it working since using custom value hidden fields didn’t offer the flexibility we needed.

Viewing 11 replies - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.