The dilemma is, while it’s technically legal to have multiple labels per input, it’s not possible to have multiple inputs per label.
While the use of a table makes sense visually here, it’s going to be a problem having it in a form like this. I notice you don’t have any form tags, but if this is getting filled in and sent somewhere, it’ll have to be a form (or is this going to be something else??).
What you might end up doing is have each group of two questions inside a fieldset. The legend of the fieldset is your “Drug one” “Drug two” etc text. Each checkbox gets its own label. Maybe those labels have to be invisible.
If someone’s in Forms Mode in a screen reader, their reader is going to ignore all the table stuff: and your table is explaining the meaning of each checkbox. So if you must keep this table setup, you’ll want at least invisible labels for those who aren’t seeing a table.
Here’s the actual form-form:
(here I have two labels wrapping and two not wrapping, just to show)
<form action="" id="formMeds">
<fieldset>
<legend>Past and current drugs</legend>
<fieldset>
<legend>Drug One</legend>
<label for="drugOnePresently">
<input name="what_meds" id="drugOnePresently" type="checkbox" value="" /> Presently</label>
<label for="drugOnePast">
<input name="what_meds" id="drugOnePast" type="checkbox" value="" /> In the Past</label>
</fieldset>
<fieldset>
<legend>Drug Two</legend>
<label for="drugTwoPresently">
<input name="what_meds" id="drugTwoPresently" type="checkbox" value="" /> Presently</label>
<label for="drugTwoPast">
<input name="what_meds" id="drugTwoPast" type="checkbox" value="" /> In the Past</label>
</fieldset>
<fieldset>
<legend>Drug Three</legend>
<input name="what_meds" id="drugThreePresently" type="checkbox" value="" /> <label for="drugThreePresently">Presently</label>
<label for="drugThreePast">
<input name="what_meds" id="drugThreePast" type="checkbox" value="" /> <label for="drugThreePast">In the Past</label>
</fieldset>
<fieldset>
<legend>Drug Four</legend>
<input name="what_meds" id="drugFourPresently" type="checkbox" value="" /> <label for="drugFourPresently">Presently</label>
<input name="what_meds" id="drugFourPast" type="checkbox" value="" /> <label for="drugFourPast">In the Past</label>
</fieldset>
<input type="submit" value="Submit" />
</fieldset>
</form>
To get it looking all fancy and table-like, I’d have to find an example brothercake posted a while ago… because styling legends is a b****. Damn near impossible. He did something else, but he did make it look like a table. Was pretty cool.
If it MUST be a table, at least make it a properly marked-up one inside a form, and you’ll need to use the title attribute on the inputs to replace the labels:
<form action="" id="formMeds">
<fieldset>
<legend>Past and current drugs</legend>
<table>
<thead>
<tr>
<th scope="col" class="invisible">Drug List</th>
<th scope="col">Currently Taking</th>
<th scope="col">Taken in the Past</th>
</tr>
<thead>
<tbody>
<tr>
<th>Drug One</th>
<td>
<input name="what_meds" id="drugOnePresently" type="checkbox" [b]title="Taking Drug One Presently"[/b] value="" /></td>
<td>
<input name="what_meds" id="drugOnePast" type="checkbox" [b]title="Took Drug One in the Past"[/b] value="" /></td>
</tr>
<tr>
<th>Drug Two</th>
<td>
<input name="what_meds" id="drugTwoPresently" type="checkbox" title="Taking Drug Two Presently" value="" /></td>
<td>
<input name="what_meds" id="drugTwoPast" type="checkbox" title="Took Drug Two in the Past" value="" /></td>
</tr>
<tr>
<th>Drug Three</th>
<td>
<input name="what_meds" id="drugThreePresently" type="checkbox" title="Taking Drug Three Presently" value="" /></td>
<td>
<input name="what_meds" id="drugThreePast" type="checkbox" title="Took Drug Three in the Past" value="" /></td>
</tr>
<tr>
<th>Drug Four</th>
<td>
<input name="what_meds" id="drugFourPresently" type="checkbox" title="Taking Drug Four Presently" value="" /></td>
<td>
<input name="what_meds" id="drugFourPast" type="checkbox" title="Took Drug Four in the Past" value="" /></td>
</tr>
</tbody>
</table>
<input type="submit" value="Submit" />
</fieldset>
</form>
With some CSS to make that work.
However, form1 > form2.