Jump to content
  • 0
Sign in to follow this  
Vitalikssssss

Event registration

Question

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

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

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

Share this post


Link to post
Share on other sites

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.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...