I'm currently developing an app in which the home page consists of set of options which the user has to select.The options are 3 dropdown lists with different data in each of them and one text field.At the bottom of the page I've a button when clicked navigates to the next page.But I want the navigation to be done only when the user enters/selects something from 2 of the 4 available fields.
I read about [disabled] function for the button.But in my case I want the button to be enabled only but still the navigation shouldn't work.
I referred this How do I enable a submit button if 1 or more checkboxes are checked? But for me the fields are made individually without using a ngFor. And I want the submit button to be enabled always.
Right now this is my html page without any restrictions:
<ion-header>
<ion-navbar>
<button ion-button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
</ion-navbar>
</ion-header>
<ion-content>
<br>
<ion-item>
<ion-input type="text" value="" placeholder="Enter Keyword" [(ngModel)]="textype"> </ion-input>
</ion-item>
<ion-item>
<ion-label>Country</ion-label>
<ion-select (ionChange)="onSelect(selectid)" [(ngModel)]="selectid">
<ion-option *ngFor="let selectid of countryData" [value]="selectid">
{{selectid.name}}
</ion-option>
</ion-select>
</ion-item>
<!--<ion-item *ngIf="compData">-->
<ion-item>
<ion-label>State</ion-label>
<ion-select [(ngModel)]="catid">
<ion-option *ngFor="let catid of stateData" [value]=catid>
{{catid.name}}
</ion-option>
</ion-select>
</ion-item>
<ion-item>
<ion-label>
Type of Vehicle
</ion-label>
<ion-select [(ngModel)]="typeid">
<ion-option *ngFor="let typeid of vehicles">
{{typeid}}
</ion-option>
</ion-select>
</ion-item>
<br>
<button type="submit" (Click)= "searchform" ion-button full > Search </button>
</ion-content>