[Pro Form] HOW TO Auto select an option in a select field when opening a popup

Hello! :slight_smile:

Is it possible to automatically select an option from a select field with a bunch of options, depending on the post the user opens the popup that contains the form?

Scenario:

  • I have CPT called Services. The CPT has several posts: Service A, Service B, Service C.
  • On the Single Service Template, there’s a CTA button that opens up a popup.
  • Then, on the Popup template, there’s a Pro Form. One of the fields of the form is a select field: Which service are you interested in?
  • The select fields show all the services. On the backend, the option field has a query loop to show all the posts from the CPT services.

So far, so good! Now, let me explain the desired behaviour I don’t know how to achieve!

Desired behaviour:

  • The user opens the popup from the page Service A.
  • The form shows the select field automatically selecting Service A.
  • If the user opens the popup from the page Service B, then the select field should be automatically selecting the Service B.

I think this has to be possible considering that Bricksforge Pro Forms is an actual beast! :fire: But I can’t find any solution or documentation :slightly_frowning_face:

There’s a Conditionally selected option under General tab, but I can’t get my head around it:

If instead of a popup it was a separate page, I would go the query param route. If instead of a select option it was a plain text field, I could populate the post_title into the value of the field. But with a select field, I have no idea what to do!

Anyone willing to help? :blush:

In the “Conditionally Selected”, what about to just enter {post_title}? Then, the option would be selected if the option value is equal to the post title of the current page.

1 Like

That’s the solution!! :star:

Thank you, Daniele!

2 Likes