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

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
Dual Super User III
Dual Super User III

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!

View solution in original post

5 REPLIES 5
Dual Super User III
Dual Super User III

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!

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)

Dual Super User III
Dual Super User III

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!

View solution in original post

Perfect, thank you!

Hi @yashag2255 

I just followed same for textbox property

in my case users will enter like 20,30,50,60, here as per your formula fine 

but the moment when i/users enter outside TextBox means if click any next textbox or control its clearing with blank.

entered Data should be appear untill they enter and submit the form.

your help will be highly appreciated. 

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

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

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (14,021)