I have a form field called quantity that needs to be filled out. But in my form I have a couple ways I'd like to get the value. I'm not sure whether to approach this with JavaScript, create separate field names for each entry option, or something totally different. Thanks in advance for any insight you can give me on this!
Here's the question: "How many people are you registering?"
Option 1: "Myself Only"
Option 2: "Myself and __ Others"
Option 3: "I'm registering __ people on their behalf"
My initial thought was to have the following HTML (forgive the crudeness of formatting):
<input type="radio" name="quantity" value="1" /> Myself only<br />
Myself and <select name="quantity">
<option value="0"></option>
<option value="2">1 other</option>
<option value="3">2 others</option>
<option value="4">3 others</option>
<option value="5">4 others</option>
<option value="6">5 others</option>
<option value="7">6 others</option>
<option value="8">7 others</option>
<option value="9">8 others</option>
<option value="10">9 others</option>
</select><br />
I'm registering <input type="text" name="quantityplus" /> people on their behalf.
The rest of the form gathers contact information, and then on the next screen would display a set of registration fields (name, email etc) based on the quantity selected in this step. On that last one (quantityplus) I'd have a listener in my form processing code to exclude the contact info provided on this page and display the actual # of people listed in that field's value (picture a scenario where an administrative assistant would be registering her boss & 5 others for a seminar, but is not attending herself).
Would this be the optimal way to approach the problem? Or should I have a hidden quantity field that gets updated using JavaScript before the form is submitted? If so, how do I account for the quantityplus issue?