Hi People,
I'm just getting started with Formidable Forms, so I appreciate your patience.
Assistance would be greatly appreciated.
I have below line in my Views->details page.
[if frm-field-value field_id=49 entry=[250] equals="Dogs"]The specie is a dog related entry[/if frm-field-value]
So what Im trying to do is:
Formidible returns the following [if frm-field-value field_id=49 entry=11 equals=”Dogs”]This is a dog entry[/if frm-field-value]
What is the correct way of doing this or is my syntax incorrect.
I suggest you read up on the shortcode you're trying to use. What is entry [250]? if you want to retrieve and entry from form A, the entry ID needs to be the entry id for form A.
Also, I'm not sure you can use farm-field-value in a conditional the way you are using it. farm-field-value is a shortcode in and of itself. It needs to wrapped in own set of square brackets. An if is also it's own shortcode. You mat be better off writing your own shortcode.
Hi Victor, thanks for your repose - think you are correct - frm-field-value cannot be used in an if statement.
regarding writing my own shortcode - I can do that, but as I'm new to Formidable, I'm scared that if there is a version change then my shortcode will not work anymore.
Victor, what is your experience regarding creating custom shortcodes?
Formidable Masterminds is my website and Facebook group. I’ve been answering questions in the Formidable forums for more than a decade and have created more shortcodes than I can remember. I’ve never run into an issue of a shortcode not working because of a version change in WordPress or Formidable. There are literally thousands of hooks available in WordPress and Formidable to developers if they know how to use them.
Formidable Masterminds is my website and Facebook group. I’ve been answering questions in the Formidable forums for more than a decade and have created more shortcodes than I can remember. I’ve never run into an issue of a shortcode not working because of a version change in WordPress or Formidable. There are literally thousands of hooks available in WordPress and Formidable to developers if they know how to use them.
If you need help writing your shortcode, you can find a developer here: https://formidable-masterminds.com/developers-directory/.
Much appreciated regarding your advice - will do that.
Hi people, here is my solution curtesy of MS Copilot - whom wrote all the code and working like a dream.Much appreciated for all the help. add_filter('frm_entries_list_query', 'filter_entries_by_field_and_form', 10, 2); function filter_entries_by_field_and_form($where, $args) { global $wpdb; $form_name = 'Application Form'; // Change this to the form name you want to search in $field_id = 50; // Change to the field ID you want to filter by $target_value = 'Approved'; // Change to the value you're filtering for // Get the form ID based on the form name $form_id = $wpdb->get_var($wpdb->prepare( "SELECT id FROM {$wpdb->prefix}frm_forms WHERE name = %s", $form_name )); if (!$form_id) { return $where; // Exit without modifying the query if form name is invalid } // Get entry IDs where the field matches the target value $entry_ids = $wpdb->get_col($wpdb->prepare( "SELECT item_id FROM {$wpdb->prefix}frm_item_metas WHERE field_id = %d AND meta_value = %s", $field_id, $target_value )); if (empty($entry_ids)) { return $where; // Do not modify the query if no matching entries are found } $where['it.id'] = array_merge((array) $where['it.id'], $entry_ids); // Ensure existing entries are not removed return $where;}
Please login or Register to submit your answer