Monthly Archives: August 2015

Search for repeating sections in Formidable Pro

One of the pain areas while working with repeating sections in Formidable Pro is that the fields contained in repeatable sections are not searchable.

Unable to search for certain fields in a form really defeats the purpose of including such fields in the first place. Formidable team is going to roll out a fix in the next release, but there is a workaround to fix it locally unless the next version of FP is made available.

Please note that the changes suggested here are to the core FP source and kindly ensure to take a back-up of entire FP source code. The steps are given below:

1. Go into formidable/pro/classes/helpers/FrmProAppHelper.php. Near line 448, you’ll see this:
$new_ids = FrmEntryMeta::getEntryIds( $where_statement, '', '', true, $filter_args );
Right above it, add this:
$filter_args['return_parent_id'] = ( $where_field->form_id != $args['form_id'] );

2. Next, go into formidable/classes/models/FrmEntryMeta.php. Near line 293, you’ll see this:
$query[] = $unique ? 'DISTINCT(it.item_id)' : 'it.item_id';
Replace it with this:
$defaults = array( 'return_parent_id' => false );
$args = array_merge( $defaults, $args );
if ( $args['return_parent_id'] ) {
$query[] = $unique ? 'DISTINCT(e.parent_item_id)' : 'e.parent_item_id';
} else {
$query[] = $unique ? 'DISTINCT(it.item_id)' : 'it.item_id';
}

This should fix the search issue with fields in repeatable sections. Hope this helps! Please let me know if there is a better solution to the same problem.