Score:0

Limit avaliable dates in a event where user can sign up mutiple people in multiple dates in one single form

cn flag
Pin

Problem context

I'm bulding a site where parents can sign-up their childrens for a summer camp. Parents can choose one or more weeks for sign-up one or more children in the same form.

There are 20 seats for each week, and 8 weeks to choose, so parents should know how many seats are avaliable in each week to manage to sign-up their children (usually they prefer their children go together but if is not possible they could sign-up childrens in different weeks).

So far my best approach is:

  • A single form for camp registration (Webform, what a great module/s)
  • Weeks are options in a "checkboxes" element, so multichoice selection of weeks is possible.
  • Duplicate the previous element for each child. I did it 5 times, so parents can register up to 5 children per submission.
  • Then I set an "Option/Checkbox Limit" handlers to set 20 as limit in each week.
  • Duplicate the previous handler for each children (5 times) and asociate it to correspondent "checkboxes" element.

The problem with this approach is that limits are independent beetween elements, so in the same form you can sign-up five childrens in first week and 19 seats are still avaliable instead 15 (20-5).

Comments:

  • I'm site builder, not developer, with an upcoming deadline, so I discard to develop a module.
  • I try "custom composite" element but handlers are not avaliable for it.
  • Module "Webform Demo: Event Registration System" has a "global" limit defined as a field in a content type "Demo: Event" controlled by a handler but I dont realize how to apply it to this case.
Score:0
in flag

I'd do this with two content types, rather than webform:

  1. Available slot-dates
  2. Sign-ups

You create the content for the available slot-dates (one node per date-slot), parents create the sign-up content. The Sign-up content includes the basic information that you need for kid's background context. After, you can add a paragraph to this content type that allows parents to specify the week that they sign their kids up for. Do this through an entity reference to your content, Available Slot-Dates. The benefit of this is that paragraphs on the node/add form allows the user to add another paragraph (in your case, this lets them select another week and/or add additional kids, without seeing extra form fields, or being limited to 5 kids/submission).

Then, you can track which of the Available Slot-Dates have been claimed by creating a rule that changes a field on the available slot-dates content that was referenced by the parent-created sign-ups.

Finally, you can only show parents dates that are available by creating a view for the entity reference. Filter for available slot-dates that are still available using the indicator field from the prior step. If you use this view on the entity reference field, then parents will only be able to select dates not yet claimed.

Pin avatar
cn flag
Pin
Hi Grayson, very interesting approach. Could you detail how to do this rule?, specifically "Condition" part. I suppose rule "Event" is "After saving element of content type sign-up" and rule "Action" is "Set a data value" in "Available Slot-Dates" to "not avaliable".
Grayson Cooper avatar
in flag
That's it! For the conditions: 1) Entity has field: [node-created] | Entity Reference; 2) Entity has field: [node-created:entity-reference] | date-available. Then use the action to set the value of [node-created:entity-reference:date-available]
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.