Limiting Form Submission

Est. Reading: 1 minute
By: americankumista
Created: 03/24/2017
Category:
Difficulty: Intermediate

Limiting Form Submission

×Warning: This tutorial was created 2682 days ago. Some of the information may be out of date with more recent versions of Formidable. Please proceed with caution and always perform a backup before adding custom code.

The code below uses the php switch statement (a case structure) to evaluate certain forms to determine if they hit their limit. The echo command lets me output alternate actions if the limit is reached. If the form limit has been reached, the page displays options for the user to select. In the example, I've noted a wait list page which would display another form.

'add_action('frm_display_form_action', 'limit_entry_count', 8, 3);
function limit_entry_count($params, $fields, $form){
remove_filter('frm_continue_to_new', '__return_false', 50);
$count = FrmEntry::getRecordCount($form->id);     // Gets the record count for the current form
switch ($form->id) {
case 25:    // Evaluates for Form 25
if ( $count > 25 ) { //sets a limit for 25 submissions. You could also use >=26
echo '

The Formidable Forms Class you selected is full.

;
We hope to offer this class again in the future, so please keep
an eye on our Facebook page or our website
';
add_filter('frm_continue_to_new', '__return_false', 50);
}
break;
case 26:
if ( $count > 10 ) { //sets a limit for 10 submissions. You could also use >=11
echo '

The Rice Cooking Class you selected is full.

;
We hope to offer this class again in the future, so please keep
an eye on our Facebook page or our website
';
add_filter('frm_continue_to_new', '__return_false', 50);
}
break;
}
}
'

Leave a Reply

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
crosschevron-leftchevron-rightarrow-right