• Hello,

    I am testing Forminator to replace Caldera, which is being sunsetted by the end of the year. All looks great, with only one thing I can’t figure out how to do it.

    With Caldera, I can set a default value for a drop down/select field based on the postid where the form is embedded on. It’s similar to the Pre-populate field from Forminator, except that it can be used for more then just the get variable from a query string, they call it magic tags (see link).

    It works like this:
    Set the default value of the drop down field to {embed_post:ID}
    Enter the postid as the value for each select option.

    Use case:
    I have form to book a course.
    The drop down field gives a choice out of 5 courses.
    Each course has a details page where the booking form is embedded.
    The drop down is pre-populated with the course of that page.
    There is also a general booking page where the drop down is not pre-populated.

    Is there a way to do this with Forminator?

    Also, I read somewhere that WPML integration is on the roadmap. Any idea where/when?

    Thanks
    JP

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

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Nebu John – WPMU DEV Support

    (@wpmudevsupport14)

    Hi @jpnl,

    I hope you are keeping well.

    I am afraid, this is not possible with Forminator forms out of the box. However, I have pinged our developers to check if an easy workaround could be suggested.

    Kind Regards,
    Nebu John

    Hi Nebu, did you find a workaround?

    And is it something that could be taken as a feature request?

    Thanks
    JP

    Plugin Support Adam – WPMU DEV Support

    (@wpmudev-support8)

    Hi @jpnl

    Please try this code:

    https://gist.github.com/wpmudev-sls/adb493e7154f135fdf04db883e18927a

    In these lines you would “map” the options to post IDs:

    $selected_options = array(
    	// post_id => options value
    	15 => 'one',
    	27 => 'two',
    	63 => 'Option-3',
    );

    Let us know if this works for you, please!

    Best regards,
    Adam

    Plugin Support Kasia – WPMU DEV Support

    (@wpmudev-support2)

    Hello @jpnl ,

    We haven’t heard from you for some time now, so it looks like you don’t have more questions for us.

    Feel free to re-open this ticket if needed.

    Kind regards
    Kasia

    Sorry for the late reply, I couldn’t test this earlier.

    Thank you for the code snippet. It works. It;s a nice workaround, but a bit difficult to maintain when you have to edit the values in the php file.

    Would you please consider adding this as an option to Forminator?

    Here is a screenshot from Caldera with explanation on how they do it:
    https://prnt.sc/1ysyoda


    By the way, an issue I found is that the Forminator query parameter matched with the select labels in stead of it’s values. That’s challenging when you copy a form for use in another language. In that case you have to translate the labels, and because it matches on the labels, it means you also have to translate all values of query parameters in referring links. In this case it would be better if it matched on the options values, so you can translate the label and leave the value and url’s as is.

    Thanks
    JP

    Plugin Support Pawel – WPMU DEV Support

    (@wpmudev-support9)

    Hello @jpnl !

    Hope you’re having a good day!

    Would you please consider adding this as an option to Forminator?

    Sure, this sounds like a good idea! I’ve created an improvement request already 🙂

    As for the issue with query parameters matching – please open a separate ticket, it sound like something we should check in more detail. When opening the new ticket, please also share an example screenshot link showing this issue.

    Warm regards,
    Pawel

    Thanks Pavel,

    As for the query parameter issue, it isn’t an issue. It does use the specified values.

    But I’ll still open a separate ticket, because the value syncs with the name and that’s a problem when translating the form.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to use the postid to set a default value in a select field?’ is closed to new replies.