I'm working on a registration form that collects student information and the class session they're signing up to. Class sessions are of select type and has four options (sessions). Each sessions has a cap of 38 students. Is there any way to automatically disable options once submission count reaches the cap..? Please note that this is a field level condition, not the entire form level. Would that be rules? Any pointers... thanks!
1 Answer
I would approach this by using
hook_webform_submission_insert (which is triggered after the submission is inserted into the database)
Once in that hook i would use webform_get_submission_count to get the number of submissions , if this was the last allowed submission i would then unpublish the node and create a redirect to a "this class is now closed page".
You could also approach it by using hook_webform_submission_presave or a custom form validator to generate a form error.