Disable button as long as the field is blank


#1

Hi everybody !

I would like to be able to disable the search button as long as the “Name” field is empty.

If someone could tell me how to do please, I thank you in advance

Here is the code of my page:

<form ng-controller="SearchCtrl" id="form5" class="list">
      <label class="item item-input" id="search1" style="">
        <i class="icon ion-search placeholder-icon"></i>
        <input placeholder="Name" type="text" ng-model="form.fname">
      </label> 
      <div class="item item-body">
          <ion-list modal-select="" ng-model="form.agency" options="agency" modal-title="Select a agency" has-search="true">
            Agency :
            <div class="option">
              {{option.name}}
            </div>
            {{form.hopital.name}} 
          </ion-list>  
      </div>
      <a class="button button-positive  button-block" ng-disabled="isValid()" ng-click="search()">Search</a>
      <div class="spacer" style="width: 283.2px; height: 14px;"></div>
      <ion-list id="menu-list1">
        <ion-item ng-repeat="item in list track by $index" ng-click="showFiche(item.id)">{{ item.fname | UpFirstLetter }}</ion-item>
      </ion-list>
    </form>

#2

What is the code of [quote=“CiKay, post:1, topic:88347”]
isValid()
[/quote]
?