How to access attributes in display-frm-data shortcode

By: Andrew Christensen | Asked: 05/10/2024
ForumsCategory: General questionsHow to access attributes in display-frm-data shortcode
Andrew Christensen asked 8 months ago
I've added the following to a page:

[display-frm-data id=354 county="San Diego" industry="Advanced Manufacturing"] In the view I can easily enough filter by the county field using [get param=county]. But the industry is more complicated beause there's 7 columns that have to be checked.

In other pages, it's simple enough to just use the $_REQUEST params and not put any attributes in the shortcode. But in this particular use case, I don't have any uri params to use. So, how do I get the attribute values when I use `frm_view_order` or frm_where_filter functions?  
1 Answers
Victor Font answered 7 months ago
I don't understand you question. What attribute values? What exactly are you trying to do?
Andrew Christensen replied 7 months ago

In the example shortcode I posted above `[display-frm-data id=354 county="San Diego" industry="Advanced Manufacturing"]` the attributes are `county` and `industry`.

When I add the filters `frm_view_order` or `frm_where_filter` I can't figure out how to get the value of `county` and `industry`. They aren't uri request params.

Victor Font replied 7 months ago

You still use the [get param] shortcode.

Andrew Christensen replied 7 months ago

How do I use that inside the PHP code? I'm needing to take the value of `industry` and query a particular column. I was trying to follow the examples you gave for the `frm_view_order` which worked very well when I have uri request params because in PHP I can get the values using $_REQUEST. But that doesn't work when the params are added as attributes and not in the URI.

In this project, I have 7 possible industries, each with it's own field in the database. What I need to do is get the value of `industry` and then get the entries where the county form field equals the `county` attribute and where the form field for the value of `industry` is greater than 0. In the example above, this would be the field for "Advanced Manufacturing".

I could in the filters for the view select the "Advanced Manufacturing" field and set it to gte to 1 but then that view would only work for that one industry so I'd need to have a separate view built for each industry which is what I'm trying to avoid.

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