3

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

1 Answer 1

0

I would approach this by using

hook_webform_submission_insert (which is triggered after the submission is inserted into the database)

http://www.drupalcontrib.org/api/drupal/contributions%21webform%21webform.api.php/function/hook_webform_submission_insert/7

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".

http://www.drupalcontrib.org/api/drupal/contributions%21webform%21includes%21webform.submissions.inc/function/webform_get_submission_count/7

You could also approach it by using hook_webform_submission_presave or a custom form validator to generate a form error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.