JOGO
JOGO

Reputation: 315

Angular: How to enable a text box if other text box input is valid

On load i am keeping second text box disabled.I am validating 1st Textbox input and then passing placeholder to the second check box. At the same time i want to enable 2nd text box field. How to do that?

  <label for="customerRequestId" class="col-sm-1 control-label">Product</label>
  <div class="col-sm-2">
          <input type="text" class="form-control" name="customerProduct" ng-model="customerProduct"  ng-blur="validatecustomerProduct()"/>
  </div>
        <label for="customerPeriod" class="col-sm-2 control-label">date Period</label>
  <div class="col-sm-2">
          <input type="text" class="form-control ng-dirty ng-invalid ng-invalid-pattern ng-invalid-required" name="customerPeriod" placeholder="{{datePlaceholder}}"disabled="disabled"ng-model="customerPeriod"   />

  </div> 

Upvotes: 0

Views: 628

Answers (1)

Gustavo Hoirisch
Gustavo Hoirisch

Reputation: 1657

Look into ngDisabled - https://docs.angularjs.org/api/ng/directive/ngDisabled - and use an expression that matched the validation you need.

<INPUT
  ng-disabled="expression">
...
</INPUT>

Upvotes: 1

Related Questions