Limit form submissions

S K asked on September 27, 2020 02:54

Hello, is there a way to set maximum number for form submissions, so that when the max number is reached, the submit button would be disabled? This form would be used for event registration with limited number of seats. MVC v12.

Thanks!

Recent Answers


David te Kloese answered on September 29, 2020 10:50

Hi,

it might be a bit tricky and not what it's designed for. But you might be able to add a form validation rule that would just check the number of records in the table:

See API examples: docs.kentico.com/api12sp/.../Formdata-Loadingdatarecordsfromaform

`ObjectQuery<BizFormItem> data = BizFormItemProvider.GetItems(formClassName);`

And just count the records. You might want to include a specific event ID or such so you can reuse the same form. Or perhaps include another addition.

Alternatively it might be wise to just build this as a custom module with classes representing the events and attendees.

0 votesVote for this answer Mark as a Correct answer

Samy Khalil answered on October 8, 2020 20:04

Hi,

try this:

  • Create a custom macro that count number of records based on sending the form table name as a parameter.
  • Based on the count, in the form layout show/hide the submit button or other message.
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.