Support » Plugin: Forminator - Contact Form, Payment Form & Custom Form Builder » Fill a field with the current Page/post Title

  • Resolved corstojamescrabb

    (@corstojamescrabb)


    Hi Folks,

    How can i get a input field to dynamically pre populate with the page/post title?

    It can be done with a “hidden field” type using the default values options but i cant seem to have it so its displayed.

    Cheers

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Kasia – WPMU DEV Support

    (@wpmudev-support2)

    Hello @corstojamescrabb ,

    Do you mean you want to have a regular input field that would have post title pre populated? Or you have trouble displaying the hidden field after the submit?
    Let us know.

    kind regards,
    Kasia

    corstojamescrabb

    (@corstojamescrabb)

    Hi Kasia,

    Yes the first, I am trying to pre-populate a regular field with the current post/page title.

    Kind regards

    James

    corstojamescrabb

    (@corstojamescrabb)

    Hi @wpmudev-support2

    Is this something that can be done with forminator or will i need to use a different form plugin?

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @corstojamescrabb

    I hope you are doing well.

    I’m afraid it only has the option for hidden fields.

    But a trick is copying the hidden field value into a regular text field.

    Add the hidden field, select it to embed URL, add a new text field, get both fields ID.

    https://monosnap.com/file/gA7RJzYS2hZc7DR3cEboxZqDVqdKHf

    Most of the theme has this section, so you can find if your theme has option for custom JS, you can use a JavaScript like this:

    (function() {
      const hidden = document.querySelector('#forminator-module-1888 #hidden-1');
      document.querySelector("#forminator-module-1888 #forminator-field-text-1").value = hidden.value;
    })();

    Replace the #forminator-module-ID, the #hidden-1 & #forminator-field-text-ID to match your IDs.

    In case you need to help on finding those, you can export the form following this guide:
    https://premium.wpmudev.org/docs/wpmu-dev-plugins/forminator/#import-export

    And share using https://pastebin.com/

    Let us know if you need any further help on this.
    Best Regards
    Patrick Freitas

    Plugin Support Predrag – WPMU DEV Support

    (@wpmudev-support1)

    Hello, we haven’t heard back from you in a while so we will close down this ticket, if you have any followup questions feel free to reopen it.

    Cheers,
    Predrag

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