cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Prevent User From Inputting a Decimal

Hi all,

 

I am having an issue where I need to be able to prevent a user from inputting a decimal "." inside of a DataCardValue input on a form within PApps 

 

I have tried the Text(Value(Parent.Default), "[$-en-US]#") formula. However that only changes the number that they inputted after the form is saved. I need to be able to prevent the user from inputting a decimal place at all. Or at the very least show a flag that warns that a decimal place was entered.

 

Any feedback will be very helpful. 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Prevent User From Inputting a Decimal

Hi @swan_soup ,

 

Do you want to prevent user to input decimal?

You can consider the following woraround,I test as next:

Add one textinput control and TextInput1.OnChnage:If(Value(TextInput1.Text)/Value(RoundDown(Value(TextInput1.Text),0))<>1, Notify("No need decimal,please try again!",NotificationType.Error);Reset(TextInput1))  (I use rounddown to test, you can consider use round or roundup based on your situation)

prevent decimal.PNG

test:

20190328preventdecimalgif.gif

 

Hope this could be helpful.

 

Best Regards.

Yumia

 

View solution in original post

3 REPLIES 3
Highlighted
Community Support
Community Support

Re: Prevent User From Inputting a Decimal

Hi @swan_soup ,

 

Do you want to prevent user to input decimal?

You can consider the following woraround,I test as next:

Add one textinput control and TextInput1.OnChnage:If(Value(TextInput1.Text)/Value(RoundDown(Value(TextInput1.Text),0))<>1, Notify("No need decimal,please try again!",NotificationType.Error);Reset(TextInput1))  (I use rounddown to test, you can consider use round or roundup based on your situation)

prevent decimal.PNG

test:

20190328preventdecimalgif.gif

 

Hope this could be helpful.

 

Best Regards.

Yumia

 

View solution in original post

Highlighted
Frequent Visitor

Re: Prevent User From Inputting a Decimal

Hey Yumia,

 

That worked perfectly! 

Thank you so much. 

 

-swan

Highlighted
New Member

Re: Prevent User From Inputting a Decimal

Hi,

 

How to restrict upto 4 decimals. The text box should not accept beyond 4 decimals while entering.

Can you help me.

 

Thank you in advance.

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Come join us today! Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (3,058)