Set number of rows for repeating section

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
}

Leave a Reply

Your email address will not be published.

I accept the Privacy Policy


Recent Posts

November 14, 2021
I can't believe this is necessary, but...
October 5, 2020
Easy Ways To Automate Your Website - 2 approaches

Isn't technology supposed to make life easier? I recently built a tool for a provider of an ERP system, to allow his clients to automatically publish inventory to their business websites and keep the sites in synch with his system. It got me thinking (again) about automation, and how business can do more with tools they're already using.

June 17, 2020
The Pivot: Making the shift from Commodity to Consultant

A lot of people - even companies - that provide technical services find themselves in the unfortunate position of being viewed as "the techs" and ignored when discussion turns to policy, marketing, or other topics relating to business management and strategy - the domain of consultants. This can be the case whether the tech is a twenty-something fresh out of school, or someone who's been in the industry for decades.
It's difficult to change people's perception once you've been slotted into a role. Far better to set expectations at the beginning of a relationship than try to change mid-stride.

June 4, 2020
An office without walls. A business without borders. There's no need to meet in person.

I should have known better, but I was hit with a wave of panic when the government announced the beginning of the corona virus lock down. I thought that might be it for my business. How would I get new clients? What about the meetings I had already scheduled? What if everybody stopped spending? Even in a digital business it's sometimes difficult to see past traditional expectations.

To my eternal relief, I learned better.

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

Email sending image

You have Successfully Subscribed!