Using javascript, I need to limit the amount of form registrations submitted to QuickBase using a predefined number and then show a message if this is ever reached.

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • Answered
Hi,

Using javascript, I need to limit the amount of form registrations submitted to QuickBase using a predefined number and then show a message if this is ever reached.


How would I approach this?

I can set up a form that submits fine but I dont want the form to show if all the spaces are full for the event they are registering for.

Cheers,

A.
Photo of Adrian

Adrian

  • 0 Points

Posted 2 years ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,096 Points 50k badge 2x thumb
I can't help you with javascript, but typically the Relationship setup would be that 1 Event has many Event Registrations.  Then a field on the Event defining the number of seats available for that Event.  

Then a summary field on that Relationship to count the number of Event Registrations.

Then a calculated field of the number of spots remaining.

Then look that up down to the child record Event Registration table and have a form rule to have the form behave differently of there are no slots left.
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,004 Points 20k badge 2x thumb
I quickly created this demo using my six proposed Empower 2017 presentations:

Dan's Empower Presentations
https://haversineconsulting.quickbase.com/db/bmfxpynfw?a=td

Speculatively, my presentations are very popular and far reaching and registrations are nearing the capacity set by the fire marshal for the room. If you click the Add Attendee button and the number of attendees is already at the capacity a dialog will display and the form will be disabled.

Note that this demo was created very quickly and a number of things might be done differently if this was for production or if I ate something different for lunch. But in any case the OP's question is a common requirement in scheduling or allocating any limited resource and can be accomplish in a variety of ways. Also, I am working with the QuickBase Empower advance team to obtain larger rooms for those QuickBase Empower presentations that are at capacity already. Finally, I created this demo to add registrations ONLY from the above report - there will be other ways to create attendees that sneaks over the capacity set for the presentation. This is easily fixed with a little more code or another approach but it is easily addressed.

Here is the code:


Pastie Database
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=541

If you need assistance implementing this solution fee free to contact me using the information in my profile:



https://quickbase-community.intuit.com/users/513/