Forum

Thread tagged as: Question, Forms

Form Submission Max Number

Hello,

is it possible with the Form App to stop or disable form submissions after a maximum number of responses have been made / received ?

Scenario:

I am using the Events App to promote open days and would like the ability for people to book via the Form App. However, we don't want to over book as we only have a limited number of places available per open day.

Cheers.

Gary Thompson

Gary Thompson 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

The Forms app doesn't do that, no. It's intended for simple contact forms.

Simon Clay

Simon Clay 127 points

Hi Gary,

I was interested to see if this could be done, so I created an app for you :)

Download and unzip sly_countresponses and place the folder in perch/addons/apps/

https://www.dropbox.com/s/p9q48f23d2888ep/sly_countresponses.zip?dl=1

Add 'sly_countresponses', to perch/config/apps.php

Then you can test to see if there are any spaces left before outputting the form. The app returns the number of spaces left, so you can add a message like: 'There are only * spaces left, apply now':

<?php 

  // ENTER THE TWO ARGUMENTS ('the Exact Form Name', max number allowed);
  $remainingSpaces = sly_countresponses('Signup Form', 100); 

  // THEN TEST TO SEE IF THERE ARE ANY SPACES LEFT  
  if ($remainingSpaces > 0) {

  echo('There are ' . $remainingSpaces . ' spaces remaining. Fill in the form to book your place...');
  // PUT YOUR FORM HERE

  } else {

  // OR, IF THERE HAVE BEEN MORE THAN THE TOTAL ALLOWED
  echo("Sorry, we're full");

}

?>