Passing parameters to Modal popup (Custom URL)

By: Rudi JvR | Asked: 11/20/2023
ForumsCategory: General questionsPassing parameters to Modal popup (Custom URL)
Rudi JvR asked 8 months ago

I'm constructing a custom URL link which when clicked opens a popup displaying the Detail View of form entries.

My question is, how do I pass parameters to the pop up window so that I can apply filters etc. using [get param="x"] for instance?

 

This is the link I build up using SQL: c0ncat('[frmmodal-content size="large" label="Detail View"][display-frm-data id=1931 entry=',d.item_id,'][/frmmodal-content]') as DetailLink  

 

Any guidance or suggestions are appreciated as always :)

1 Answers
Rob LeVineRob LeVine answered 8 months ago
You add the parameters to the opening frmmodal-content, e.g., [frmmodal-content size="large" label="Detail View" x="value"]
Rudi JvR replied 8 months ago

Hi Rob - Firstly thank you for your suggestion and help! I've spent the day attempting to pass parameters like you suggest but without success.

I just did a test using a detail link directly on my view, and I pass my parameter to this link "/?species=[474]"
When I click this detail link on the view, it opens the target page and filters the nested view (using [get param="species"]) on this page as expected.

Using the Modal setup: Clicking my custom link constructed with SQL, which targets the same Detail View i.e.: [frmmodal-content size="large" label="Detail View" species="d.meta_value"] the parameter specified is not used to filter the nested view on the modal pop up?

It seems as if the parameter is not passed in the [frmmodal-content] shortcode - Am I missing something? Or do you have a suggestion of how I can check if the parameter is present on the pop up page?

Here is the URL I create with SQL if it can help with figuring this out:
C0NCAT(
'[frmmodal-content size="large" label="Detail View4" species="', d.meta_value,'"]
[display-frm-data id=1931 entry=',d.item_id,'][/frmmodal-content]'
) AS DetailLink4

Rob LeVineRob LeVine replied 8 months ago

I suggest you use WordPress debugging to output the complete shortcode that's being written out and hopefully that'll make it clear why the parameter isn't working. WordPress isn't going to care how you create it, just that its format is correct. You can also try hardcoding a value in for the species and entry values and if it doesn't work, then it's something other than the values themselves.

Rudi JvR replied 8 months ago

Some feedback on this issue if it may help anyone in future:

The parameters should be specified in the second shortcode ([display-frm-data]) and not the first i.e.:

[frmmodal-content size="large" label="Details"][display-frm-data id=1931 filter=limited entry="x" param1="value" param2="value"][/frmmodal-content]

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right