Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter Imran Siddiq

    (@flickimp)

    Changed my mind.
    Using the Hidden Field to show Page Id ….. ie: 170 for the current page

    But when using Visibility Logic – it doesn’t hide when the field is 170 (because the rule was to only show when page id is 182)

    • This reply was modified 4 years, 4 months ago by Imran Siddiq.
    Thread Starter Imran Siddiq

    (@flickimp)

    Would be really good if someone can workout how I make the Hidden Field pickup the Post ID of a page.

    Because at the moment it’s not working.

    Plugin Support Predrag – WPMU DEV Support

    (@wpmudev-support1)

    Hi @flickimp,

    You can find more information on how to use the pre-populated fields on our docs page here:
    https://premium.wpmudev.org/docs/wpmu-dev-plugins/forminator/#pre-populate-form-field-values

    However, I’m not sure that I understand completely what is supposed to happen so would you mind explaining a bit with step by step on how the forms should work and what should happen?

    Also, about the Page ID not working, are you saying that it doesn’t pick up the ID in the current form or that it doesn’t pass that on the second form?

    Cheers,
    Predrag

    Thread Starter Imran Siddiq

    (@flickimp)

    I hope this helps;

    Say you got to a Webpage https://www.fake.com/Location1

    The Page ID for this is 155

    I have a form that has 10 Datepickers, because each DataPicker is unique per location (in terms of selectable days etc)

    When the user goes to this page, the datepicker for this form has a rule = Only show when the Hidden Field = 155

    And the Hidden Field was set up to be the Post/Page ID

    But at the moment, when you go to the page, it shows all 10 datepickers and isn’t restricting itself to only show 1, because the other 9 pages have different Page IDs.

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @flickimp ,

    It looks like Hidden Field is setting the value to Page ID correctly, however, it’s not working with the Conditional settings of other fields.
    I’ve reached out to the Forminator team about this issue to see if there is way to make it work. We will keep you updated.

    kind regards,
    Kasia

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @flickimp ,

    I’ve talked with developers and this is a bug with the hidden field. Right now it can’t be used for the visibility rules. I’ve reported that bug and developers will take care of it.

    kind regards,
    Kasia

    Thread Starter Imran Siddiq

    (@flickimp)

    Thanks

    Is there a way to not use a hidden field?
    So could I use a Name/Text field that just pulls in the Page ID?

    And then I can use that for the visibility rules.

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @flickimp

    I hope you are doing well.

    You can a query parameter for this, the same way that @wpmudev-support1 suggested:
    https://premium.wpmudev.org/docs/wpmu-dev-plugins/forminator/#pre-populate-form-field-values

    However, for this, you would need to add the parameter to the URL, for example

    /my-form/?id=10

    I pinged our developers to check if there any other way for that may be using some JavaScript.

    We will update once hearing back from the developers.

    Best Regards
    Patrick Freitas

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @flickimp

    I just received an update from our developers.

    I found a workaround that you can try using some custom JavaScript.

    On this thread, you can find a custom code that collects the page ID using JavaScipt: https://stackoverflow.com/a/43809212

    Once the ID stored on a variable, you can set the value on your regular text field using:

    document.getElementById('forminator-field-text-1').value=id;

    And then trigger the conditionals using:

    jQuery("#forminator-field-text-1").trigger('change');

    https://monosnap.com/file/J4t5egaFJkt0yLtqr9Xmpc6NNkRfVh

    Just replace the forminator-field-text-1 to your field ID.

    https://monosnap.com/file/mxlSFjNmYgLWSK2LF30eTtkJPzCHcJ

    Most of the time the theme options has the field to add custom JavaScripts code, but in case it doesn’t have, you can use a plugin like https://www.ads-software.com/plugins/custom-css-js/ just make sure the JS loads on the footer.

    Let us know the result you got.
    Best Regards
    Patrick Freitas

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Query Parameter’ is closed to new replies.