We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Question, Configuration, Suggestions

Disable a form

Hello,

What is the Perch recommended way for disabling a form from showing or allowing any more submissions to be made after a specific number of submissions have been reached ?

If possible?

Thanks

Gary Thompson

Gary Thompson 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

There's nothing built in to do that.

Simon Clay

Simon Clay 127 points

Hi Gary, yes there is. I created an app to do this.

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 the max number has been reached 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); 
    $submissionsRemaining = sly_countresponses('Signup Form', 100); 

    // THEN TEST TO SEE IF THE MAX NUMBER OF SUBMISSIONS HAS BEEN REACHED  
    if ($submissionsRemaining > 0) {  

        // PUT YOUR FORM HERE  

        } else {

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

Hello Simon,

Thank you very much!! I am truly humbled by your quick and proactive response.

This looks perfect!

:D