9 months ago

How to handle the value that is no more in dropdown list?

Posted 9 months ago by SunnyBoy

Here is my problem: In Laravel 6, i have a required element with the current options let say a, b, c:

<select class="form-control" name="mySelect" required>
    <option value="a">a</option>
    <option value="b">b</option>
    <option value="c">c</option>

However, say d was a valid option previously and was saved to my back-end database. So now when I load my page, I'm setting mySelect to what is stored in the database but the select element is empty because d isn't an option anymore.

How can I make it so my select element as Invalid if it has a value that is not a valid option?

Please sign in or create an account to participate in this conversation.