We are starting to use Umbraco Forms with the latest version (Forms 6.0.1).
We need to put a quota on the maximum number of responses, in order to manage a course booking system.
After 20 bookings, the form has to change to display a message saying something like "Sorry, the maximum number of participants for this event has been reached" and block the form submit.
If you look into the App_Plugins folder, there should be an UmbracoForms folder with all the code.
The first interesting bit is the /backoffoce/dashboards/controllers/yourforms. It contains a bit of js code that loops over the form data retrieved from somewhere else and prepares the data to give those counts in the backoffice
Second bit is in js/umbraco.forms.js there is a function in there called formResource that has a method GetOverView which is used by the first bit.
Normally you render a form on a specific node. I usually select the form I want to show with a form picker. This formpicker contains a guid
So...
In your razor template you should be able to do an http call to the umbraco forms api to get the overview of all your forms. Then filter out the form data (including its entry count) by the guid of your picker. And finally not run the Macroscript but show a message if the count is higher than x.
Umbraco Forms: response number quota
Hello,
We are starting to use Umbraco Forms with the latest version (Forms 6.0.1).
We need to put a quota on the maximum number of responses, in order to manage a course booking system.
After 20 bookings, the form has to change to display a message saying something like "Sorry, the maximum number of participants for this event has been reached" and block the form submit.
Any idea how to do it?
Thank you for your reply.
I don't think its simple, but it might be doable
If you look into the App_Plugins folder, there should be an UmbracoForms folder with all the code.
The first interesting bit is the /backoffoce/dashboards/controllers/yourforms. It contains a bit of js code that loops over the form data retrieved from somewhere else and prepares the data to give those counts in the backoffice
Second bit is in js/umbraco.forms.js there is a function in there called formResource that has a method GetOverView which is used by the first bit.
Normally you render a form on a specific node. I usually select the form I want to show with a form picker. This formpicker contains a guid
So...
In your razor template you should be able to do an http call to the umbraco forms api to get the overview of all your forms. Then filter out the form data (including its entry count) by the guid of your picker. And finally not run the Macroscript but show a message if the count is higher than x.
is working on a reply...