'Effect of disabled or readonly select options
I have a select where I have disabled some of the options. (Trust me, there's a valid reason for this.) Problem is that for some reason, the select is not posting with the form submit. Is there a way to prevent a user from using certain options but not impact the posting of the select for the form?
<select class="form-control" style="width: <?= $std_input_width ?>px;" name="quadrant" id="quadrant"<?= $disabled ?>>
<option value="" <?= ($row["quadrant"] == '' ? ' selected ' : '') ?>></option>
<option value="North" <?= ($row["quadrant"] == 'North' ? ' selected ' : '') ?>>North</option>
<option value="Lakeshore" <?= ($row["quadrant"] == 'Lakeshore' ? ' selected ' : '') ?>>Lakeshore</option>
<option value="Bay Central" <?= ($row["quadrant"] == 'Bay Central' ? ' selected ' : '') ?>>Bay Central</option>
<option value="Grand Rapids" <?= ($row["quadrant"] == 'Grand Rapids' ? ' selected ' : '') ?>>Grand Rapids</option>
<option value="Southwest" <?= ($row["quadrant"] == 'Southwest' ? ' selected ' : '') ?>>Southwest</option>
<option value="Southern" <?= ($row["quadrant"] == 'Southern' ? ' selected ' : '') ?>>Southern</option>
<option value="Metro" <?= ($row["quadrant"] == 'Metro' ? ' selected ' : '') ?>>Metro</option>
<option value="NE" <?= ($row["quadrant"] == 'NE' ? ' selected ' : '') ?> disabled>NE</option>
<option value="NW" <?= ($row["quadrant"] == 'NW' ? ' selected ' : '') ?> disabled>NW</option>
<option value="SE" <?= ($row["quadrant"] == 'SE' ? ' selected ' : '') ?> disabled>SE</option>
<option value="SW" <?= ($row["quadrant"] == 'SW' ? ' selected ' : '') ?> disabled>SW</option>
</select>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
