Application form with maximum number of applicants?

Good morning, I need a push to the right direction.

I have a page with some events/courses/workshops. For each event there is a button forwarding to an application form page. The button transfers some hidden data like leader of the course, date and time.The form itself is only one form for all events prefilled with appropriate data via the hidden field data from the button.

Each event has a variable amount of participants/subscribers.

Now I would like to set the amount for each event in a TV. And the form should count the applications. Ideally the count value is stored in an other TV to check when the event registration is full. Then I can close the registration/remove the send button/put a corresponding text.

UPDATE: of course the applications should be counted if the email or autoresponder is sent. Not counting errors in filling the form and submitting.

What can I do, which modx packages may be helpful? Thanks for any hints.

1 Like

you could store all form-submissions into a custom table with a formit-hook and then just count the submissions with a simple query

1 Like

Theoretically, I understand that. But I can’t program something like that, so I hoped there would be some packages or so I could use.

1 Like

I think there is no other simple way to do that, like Bruno mentioned.
What are you using for your forms? Formit? or custom made? Where do you store them?

Cheers

1 Like

I use only Formit.

At first I have a page with a course overview. Each course has some individual data like date, time and the instructor/leader. These data are hidden fields in a form button “subscribe”. This button calls the application form page where the form will be prefilled with the hidden data (now visible in the form).

On the overview page it would be nice to know how many places are left for each course. So I could lock the button if the course is fully booked. But therefore I need an information about successful transmits of the form data via email.

I would set a number of total places in a TV at the course resource. This value can be changed in the meantime because of cancellations. And I reuse the course resources for a next cours after the course has been held. Meens that the counter must be resetted with a new course date.

1 Like

I understand your point but I believe that you are trying to go on the harder direction, as Formit does not allow you to do these kind of things out of the box and I am not aware of anything that could “bond” to formit in order to do that.

Here is my suggestion (involves some work, but scalable):

  • Install Migx;
  • Plan carefully your MySQL tables for your courses (Assuming that you are comfortable with MYSQL):
    • Dedicated table for the trainers;
    • Dedicated table for the locations (if any)
    • Dedicated table for the courses;
    • Dedicated table for the courses dates (having course_parent_id field linked to the courses table, having foreign-key fields to link with location, trainers, dates, number of maximum seats, etc);
    • Dedicated table for each course date applications (you could think about “application validated” field that would serve as control field for the number of available seats calculation);
  • Create the form management through migx;
  • Create a frontend form linked to all these fields and on form submission, call a snippet to validate all the data, prepare, insert on the database and send the e-mails to the applicant.

Then you can manage the application validation through the backoffice properly. Not to say that you can make this application grow easily.

Big credits to @bruno17 that created this awesome extra and allows a lot of us to create great solutions on top of it.

I know this can be a time consuming task, but it will worth it. Don’t reinvent the wheel when it is already invented and fine-tuned :slight_smile:

In case of help (if you choose this direction), please ping us here and we will help.

Cheers and good luck

1 Like

Thanks for the tips. Unfortunately I am neither a programmer nor experienced in MySQL. I will think for a while about what other ways there might be. The project is not important until next year, until then I might find a simpler solution. Many thanks first.

1 Like

Not a problem. Now I understand why you are wanting to avoid changing your form implementation.

Even without changing the implementation method, you will always need SQL in order to read the formit form contents somehow (if not encrypted. If encrypted, I think you will face a dead-end).

Cheers

1 Like

Ok let’s think about how you could do this just with formit, or nearly so. But, it can be challenging working with an already implemented site (when you don’t know exactly how the original developer set things up).

Ok so as I remember you are comfortable with tvs? Correct me if I am wrong.

Anyway let’s talk about what your forms are doing.

What might help you learn more is to find this form and copy paste it over here. You have to put three single ticks above and below the code

So what I think you could do is put a counter as a posthook in the formit call in that form. Each event would have a counter, a tv for each, and when the event registration is successful, the posthook will add 1 to the counter. Will you have a de-registration page as well? Then the counter would just subtract one.

In order to prevent over subscription, on the page where the form appears you could poll the data in the tvs to see if they have met your maximum. If they do, you could switch out the form for another bit of content letting them know that they can’t register, or the form could easily be disabled but still appear. That’s another bit of code but still not too tough to just query those tvs. That would likely be a custom snippet on the page the form is on, at top, above the form in the code.

Hmm, now I am re-thinking the above, it would be better to disable only the option of the filled event, but let’s see what’s possible for now. Anyway you can prevent over-registration

The counter for the tv is a pretty easy bit of code, I am sure someone will provide it, once we drill down to your solution and start building it up. But we will need more info, first off how your form handles the event data.

The counter would be really simple, I don’t know this coding myself but its just GET tv named [[+event]]Subscription and add one to the result, with the tvs called event1Subsciption event2Subsciption and so on, where [[+event]] is supposed to be the prefix of the tv, so here event1 event2