Vitalikssssss Posted November 2, 2018 Report Share Posted November 2, 2018 Hi there, I have the events app. I would like to use the submission form to register event attendees. The submission form should be unavailable as soon as the number of attendees reached the limit per event. How can I do that? Thanks, vitalikssssss Quote Link to comment Share on other sites More sharing options...
0 Andrii Posted November 2, 2018 Report Share Posted November 2, 2018 Hello. Follow these steps to implement such a workflow: 1. You need to add 2 Calculated values in your Submission form to retrieve the possible amount of users for the Event and actual amount of users at the time. Here is the example of the code: -- possible amount SELECT Amount_of_people FROM Events WHERE Id = [@field:Event_ID] -- actual amount SELECT COUNT(User_Name) FROM Register_table WHERE Event_ID = TARGET.[@field:Event_ID] You can make these Calculated fields as hidden if you wrap them into two HTML blocks and insert code: <table style="display: none;"> </table> 2. Add Header/Footer and insert this snippet of code: <script type="text/javascript"> document.addEventListener('DataPageReady', function () { var availableAmount; var currentAmount; var timer = setInterval(function(){ availableAmount = document.querySelector("span[id^='cbParamVirtual1']").innerHTML; currentAmount = document.querySelector("span[id^='cbParamVirtual2']").innerHTML; if (availableAmount == currentAmount) { document.querySelector("input[value='Submit']").style.display = "none"; document.getElementById("status").innerHTML = "There is no available places"; clearInterval(timer); } else if (availableAmount > currentAmount) { clearInterval(timer); } }, 1000); }); </script> This code will check if the number of attendees are equal or not and will hide the Submit button if needed. You also need to adjust the SQL and JS code according to your element names. Please find the application attached to play around with it. Also, take a look at the Tables and Relationship between them. NOTE! This APP will work only when the value of Event is already sent as the parameter on load. JS_Display_Of_Submission_Based_on_Attendees_Amount.zip Quote Link to comment Share on other sites More sharing options...
0 AnchovyXL Posted November 9, 2018 Report Share Posted November 9, 2018 Hi, I found a cool tech tips about that: https://howto.caspio.com/tech-tips-and-articles/advanced-customizations/how-to-limit-the-number-of-submissions/ Works for me. Hope it will to you too. Thanks! Quote Link to comment Share on other sites More sharing options...
Question
Vitalikssssss
Hi there,
I have the events app.
I would like to use the submission form to register event attendees.
The submission form should be unavailable as soon as the number of attendees reached the limit per event.
How can I do that?
Thanks,
vitalikssssss
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.