I am working on a volunteer signup form where some of the fields have a limited number of slots available (for example Monday setup needs 15 people). I am good with the form in general but I need a way to determine how many slots are already filled so that the slot doesn't get overbooked. In the past I was able to do this using Freeform 3, but when the changed the structure in 4.x that option vanished. As such I bring my case to the community for guidance on the best way to accomplish this.



Couldn't you use freeform's form info tag pair to perform a conditional check? You could use that tag pair to lookup how many entries already exist in your collection, and then everything flows from there.

{exp:freeform:form_info form_name="your_form_name"}
    {if freeform:total_results < "15"}
       Thank you but this session is full
        Insert your registration form here.

You could use a math plugin to do a little number manipulation too, if you needed to indicate in the page how many spots were left.

  • Hi Jean, would it be possible to do this on specific field values? Say for example there are ten fields in the form and each one has 15 slots. How would it work if some were filled and others not? Your option appears to be limited to actual total results. – forrest Sep 5 '13 at 19:20
  • What kind of field are you using to present a given number of slots? The feature you mentioned from Freeform 3 was also a limit on total entries and not on individual fields, so I thought that's what you were aiming for. I can't think of a way you would be able to limit on a field by field basis what is aggregated in the entries within a given field. Sorry, I overlooked that being your intent. – Jean St-Amand Sep 6 '13 at 11:49
  • See my response below. This is what I was working for. Thanks for your efforts. – forrest Sep 6 '13 at 20:31

With some help from an associate we worked out the following solution using the query module.

{exp:query sql="SELECT COUNT( * ) AS itemCount FROM exp_freeform_form_entries_4 WHERE form_field_52 = 'yes'"}
                                {if 15 > {itemCount}}
              <td><label for="setup_1">Mon. Dec. 9, Setup/iron - 9am-noon: {exp:query sql="SELECT 15 - COUNT( * ) AS itemNeeded FROM exp_freeform_form_entries_4 WHERE form_field_52 = 'yes'"}{itemNeeded}{/exp:query} needed </label>
              <input type="checkbox" name="setup_1" id="setup_1" value="Yes" /></td>
                                    <td>Monday 9-noon is full</td>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.