1 year ago

#358693

test-img

Dasaya_Developer

Cannot validate dropdown items clicked or not

I was using a multi select dropdown menu inside a form in my application. And I want to disable the NEXT button if nothing is selected of dropdown. But in my code even I didn't select any option, it took as a valid option. Therefore NEXT button never disabled. Can someone help me with that?

This is my .html code

<div class="form-group row">
    <label for="billing" class="col-sm-4 col-form-label">Billing Type *</label>
    <div class="col-sm-8">
        <div class="dropdown" required>
            <button class="btn btn-light dropdown-toggle dropdown-billing" type="button" data-toggle="dropdown">
                {{selectBillingType}}
            </button>
            <ul class="dropdown-menu">
                <li class="dropdown-item" *ngFor="let item of billingTypesArray; let i=index">
                    <input type="checkbox" name="billing" formControlName="billing" value="{{item.value}}"
                        (change)="updateBillingType(item,$event)">
                    <label for="billing">{{item.billingType}}</label>
                </li>
            </ul>
            <label class="text-danger" *ngIf="gpJobsSearchForm.controls['billing'].hasError('notChecked')">
                Please select a billing Type!
            </label>
        </div>
    </div>
</div>

html

twitter-bootstrap

dropdown

multi-select

0 Answers

Your Answer

Accepted video resources