2

I have html code and it checks phone number keyed in is whether valid or not. I can't find how it check to validate the phone number.

The problem is it's validation doesn't allow + sign and start with 0. How can I allow + sign and start with 0 at phone number validation.

My html code is as follow.

<div class="form-group has-feedback">
  <div class="form-group" ng-class="{ 'has-error' : consumerRegisterForm.Office_no.$invalid && (consumerRegisterForm.Office_no.$dirty || submitted)}">
    <div class="input-icon">
      <i class="icon fa fa-phone-square"></i>
      <input type="number" class="form-control" ng-model="RegisterData.Office_no" name="Office_no" placeholder="Office Phone Number" ng-required="true">
    </div>
    <p class="validation-error" ng-show="consumerRegisterForm.Office_no.$error.required && (consumerRegisterForm.Office_no.$dirty || submitted)" class="help-block">Please Enter office phone number.</p>
  </div>
</div>
Junius L.
  • 14,324
  • 4
  • 33
  • 63
batuman
  • 6,634
  • 23
  • 93
  • 200

2 Answers2

1

Your input is type="number". It means it only allows... numbers.

As you want to use + and leading zeros, you may want to change it to text:

<input type="text" .../>
Mistalis
  • 17,145
  • 13
  • 72
  • 95
0

Use input type "text" and make directive which will fulfill your requirements

Ravi Ubana
  • 377
  • 6
  • 26