cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper I
Helper I

Number text format dont allow decimals or negatives

I have a data card field that I have set to Format: TextFormat.Number

 

However, when testing this it works perfect for preventing users inputting strings but if they enter negative(-12) or decimal (2.4)

it still work.

 

For this field I need the input to be whole number only. How may I check and then round the decimals or trim the - symbol? 

 

I can make warning signs and don't let them press submit. But I would really prefer to limit what can be typed in.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

@miss_haley 
You have to make 'warning signs' as you mentioned.  There's no way to prevent typing a valid number.

 

You can restrict input values by using another control type like a pre-defined dropdown of numbers or a Slider control.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

View solution in original post

5 REPLIES 5
Super User III
Super User III

@miss_haley 
You have to make 'warning signs' as you mentioned.  There's no way to prevent typing a valid number.

 

You can restrict input values by using another control type like a pre-defined dropdown of numbers or a Slider control.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

View solution in original post

@mdevaney 

 

to check for negative and show error I can type

If(Value(TextInput1.Text) < 0)

 

Would you know how I can check for the decimal?

I dont know how I can check if "." exist in the textinput

 

@miss_haley 
I think you can check for a decimal like this

Mod(your_number_here, 1)<>0

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

@mdevaney 

 

Thanks for reply, I use the IsMatch function and look for decimal as a regex pattern it work. 

@miss_haley 
Yes, that works too.

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (8,027)