Hiding the Selected Option From the Dropdown List
benlevydesign opened this issue · comments
Hey @benlevywebdesign! Would you be able to apply a class to the selected option that hides it?
@Robdel12 I updated my question.
@benlevywebdesign Setting .dk-option-selected
to display: none;
should resolve the issue.
@acemir I want the selected option to stay. The selected option also shows up in the choices below the disabled placeholder option.
If the choices are: Choose One(placeholder), Yes, No, Maybe and the selected choice is "Yes" then I don't want to see "Yes, Choose One, Yes, No, Maybe".
See my first comment above.
It's on forms when I get the selected value from the database. See code below:
<select class="selectoptions_ma" id="imageuploaded" name="imageuploaded">
<option selected value='<?php echo $imageuploaded ?>'> <?php echo ($imageuploaded == '1') ? Yes : No ?></option>
<option value="" disabled="disabled">Image Uploaded?</option>
<option value="1">Yes</option>
<option value="0">No</option>
</select>
How would I either make the selected value be from the order of the list or take it out and only show the non selected options below the placeholder?
orAhh, I see what you're going for now. From the example code you gave I'd write the select like this:
<select>
<option value="" disabled="disabled">Image Uploaded?</option>
<option <?php echo ($imageuploaded == '1') ? 'selected' : '' ?> value="1">Yes</option>
<option <?php echo ($imageuploaded == '0') ? 'selected' : '' ?> value="0">No</option>
</select>
That will have two selectable options in the list and it will select the right one given the value from the DB ($imageuploaded
).