I have a requirement to have multiple serial numbers for a single webform, each with its own starting and current value. Which one of the multiple serial numbers is used for a given webform submission would be determined by the value of a "select options" webform component at submission time.
The specific Use Case is an online application form for students into a primary school. The school is required to number the applications in the order they are received, so that if there are limited places, they can be allocated on a "first come, first served" basis.
I'm aware that the webform serial component (or even the webform submission counter itself) can do that, but a further requirement is that the applications for each entry class for a given calendar year are numbered separately.
In other words, there is a standard application form used, no matter what class the student will be starting in. So there is a webform component called "Starting Class" which has the following choices:
Junior Infants
Senior Infants
1st Class
2nd Class
...
6th Class
The idea is that rather than number all applicants as one large pool, each of the 8 classes would get their own serial number. The result would be that the serial numbers for each of the choices above would be maintained separately.
Also, we'd need to be able to tell the applicant what number they got in the webform reply, so it would need to be available in a token.
Comments
Comment #1
liam morlandWhat happens if you create multiple serial number components and use the conditionals system in Webform to hide all but the one you want?
Comment #2
frost commentedThanks Liam, yes that worked. I didn't realise that serial fields that are not shown don't increment.
For anyone looking to do this in future, here's a step-by-step:
1. Install Webform 4.x (which has conditionals) and webform serial
2. Create a new webform and add a Select Options component with at least 2 values. Probably best to make it a required field.
3. Add a separate Serial component for each of the values of the Select Options component.
4. Add Conditionals so that when Select Options choice N is selected, then Serial N is set to be visible
That's it.
One usability issue: The results will actually show the values of ALL the serial fields, which could be confusing, since for any given form submission, only one of the serial values is actually relevant.
I found a workaround (which seems counterintuitive to me, but it works): if you UNTICK the Private setting for the serial field components, then only the relevant serial field's value is included in the emailed result. Note that an onscreen warning says you shouldnt change the Privacy setting, so this may have unintended effects.
Comment #3
liam morlandI don't know why it says to leave it private. I am investigating if that is actually needed.