Lokesh
Lokesh

Reputation: 137

Check case of characters in angularjs

I have two options in HTML select input with values as

AbhiNAV5
RaviNATH6

User selects one of these values and that will be stored in DB. If any user directly changes the value in DB as ABHINAV5 or abhinav5 or RAVINATH6 or ravinath6 (or possibly however he want in any case), then I am not able to show the value in dropdown. Instead it adds a blank entry

Here is HTML

    <select id="Select1" clientidmode="Static" class="htmlDropdown" runat="server" data-ng-disabled="!PropCollection.IsConfigured" data-ng-model="PropCollection.ViewerName" style="width: 150px;" tabindex="2">
        <option value="AbhiNAV5">AbhiNAV5</option>
        <option value="RaviNATH6">RaviNATH6</option>
    </select>

Is there any way to handle the case? I want it to be case insensitive.

Any help appreciated. Thanks.

Upvotes: 0

Views: 27

Answers (1)

Yatrix
Yatrix

Reputation: 13785

You could simply change the model to lowercase and the values of the options to lowercase so they match-up when they're bound. Think that's the simplest solution.

Upvotes: 2

Related Questions