Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48981

number input becomes null entering 2 "-" signs

$
0
0

I have a form with a number input but it breaks if the user enters 2 negative signs.

A. Entering “-20” gets saved to the form as “-20”
B. Entering 2 negative signs “–20” gets saved as null

  1. Why is the user allowed the enter 2 negative signs when the input type is number? Shouldn’t it know that is not a proper format for numbers?

  2. How can I make sure the user can’t enter two negative signs to break the input?

Form Input:

<ion-input
  formControlName="startTemperature"
  type="number"
></ion-input>

User Enters:
Screen Shot 2022-01-06 at 12.35.33 PM

Form Value becomes null:
Screen Shot 2022-01-06 at 12.35.56 PM

3 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 48981

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>