fbpx

Sometimes you have a Search form with a repeating section in it, and are using ‘frm_get_default_value’ to populate it, but the darn thing won’t show the right number of rows. This fixes it.

add_filter( 'frm_repeat_start_rows', 'frm_set_ten_rows', 10, 2);
function frm_set_ten_rows( $row_num, $field ){
	if ( $field['id'] == 157 && isset($_REQUEST['depdob']) ) { // change 157 to the id of your repeating section
		$myarray = explode(', ',$_REQUEST['myvar']); // change myvar to your get param
		$row_num = count($myarray);
	}
	return $row_num;
}

Sometimes you just want to set the number of rows that show to a fixed number, like this:

add_filter( 'frm_repeat_start_rows', 'frm_set_ten_rows', 10, 2);
function frm_set_ten_rows( $row_num, $field ){
	$row_num = 3; // set 3 to whatever you want
	return $row_num; // or just return a number and make it one line
	// I only did it this way to make what's happening clear
}