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

Text input mode - number, blocked decimal comma

Hi,

 

I'm building an app where I need a decimal number from an user. I've tried setting the textinput's mode to Number to make things easier, but some users have reported that the button for decimal comma or dot is disabled:decimal.jpg

 

Is there anything else I have to enable, to allow users to input decimal numbers?

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Text input mode - number, blocked decimal comma

Hi @jernejp 

 

You can modify your regex as: 
 
Set(resetvar,false);Set(resetvar,If(IsMatch(TextInput1.Text,"^[1-9]\d*([.,]\d+)?$"),false,true))
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
4 REPLIES 4
Super User
Super User

Re: Text input mode - number, blocked decimal comma

Hi @jernejp 

 

Currently Text Input controls only supports two formats, Text and Number and there are few restriction on various devices types over the keyboard controls.
 
If you want user to restrict to only enter decimal points, as a workaround you can follow the below mentioned steps:
 
1) Keep the Text Format to Text.
2) Set the OnChange property of your Text Input( lets say TextInput1) as:
Set(resetvar,false);Set(resetvar,If(IsMatch(TextInput1.Text,"^[1-9]\d*(\.\d+)?$"),false,true))
3) Set the "reset" property of your text Input as: 
resetvar
 
This will reset the control if user has given value that is not a decimal.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
jernejp
Level: Powered On

Re: Text input mode - number, blocked decimal comma

Thank you for your answer. Can you help me modify the regex to include a comma or a dot?

So the user can use 1,5 or 1.5 (as we use a comma in our language to seperate the decimal)

Super User
Super User

Re: Text input mode - number, blocked decimal comma

Hi @jernejp 

 

You can modify your regex as: 
 
Set(resetvar,false);Set(resetvar,If(IsMatch(TextInput1.Text,"^[1-9]\d*([.,]\d+)?$"),false,true))
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
jernejp
Level: Powered On

Re: Text input mode - number, blocked decimal comma

Perfect, thank you!

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 193 members 4,036 guests
Recent signins:
Please welcome our newest community members: