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
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (5,106)