Is there a way to limit the number of forms that can be submitted? This would come in handy if I needed to limit the number of entries for a contest, or registration for an event, etc.

Yes, you can do this by creating a BEFORE FORM PIECE.

To do that, go to your form's properties > Advanced Tab > More Options, then click on the PIECES tab. In the BEFORE FORM section, click on the "Custom" radio button and add the code below.

IMPORTANT: You will need to change the "999" in the code below to the ID of your form. To find the ID number, go to Components > BreezingForms > Manage Forms. You will find the ID number for your form in the Script ID column.

To set a limit on the number of submissions, change the "100" in the load result line to whatever number of submissions you want to allow.

You will also need to replace the URL in the Header Location to the URL for your Limit Exceeded notice page.

 

$db = JFactory::getDBO();
$db-> setQuery("Select count(id) From #__facileforms_records Where form = 999");
if( $db->loadResult() > 100 )
{
     // replace index.php with the url to an article explaining that the max. amount has been reached
     header("Location: index.php");
     exit;
}

 

Or you can limit submissions by IP like this:

 

$ip=$_SERVER['REMOTE_ADDR'];;
$db = JFactory::getDBO();
$db->setQuery("Select count(id) From #__facileforms_records Where ip ='".$ip."' and form = 999");
if( $db->loadResult() > 3 ){
  // replace index.php with the url to an article explaining that the max. amount has been reached
  header("Location: index.php");
  exit;
}

 

The code above will limit to 3 submissions per IP address.

 

Or you can limit submissions by user like this:

$user = JFactory::getUser();
$db = JFactory::getDbo();
$db->setQuery('SELECT COUNT(id) FROM #__facileforms_records WHERE user_id ="'.$user->id.'" AND form = 999');
$db->loadResult();
if($db->loadResult() > 0){
  // replace index.php with the url to an article explaining that the max. amount has been reached
  header("Location: https://crosstec.org/en/");
  exit;
}

 

This will limit to one single submission per user.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here