cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
swan_soup
Level: Powered On

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
Community Support Team
Community Support Team

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

2 REPLIES 2
Community Support Team
Community Support Team

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

swan_soup
Level: Powered On

Re: Prevent User From Inputting a Decimal

Hey Yumia,

 

That worked perfectly! 

Thank you so much. 

 

-swan

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (2,906)