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

Force Text Input Format Number to Comma or Dot?

 

So, when I type 1000000 in that field, its automatically force to 1.000.000, how to do that? 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Microsoft
Microsoft

Re: Force Text Input Format Number to Comma or Dot?

Hi redlyst,

 

You can try the Text() function to format numbers using commas and periods.

I'm not sure how you can format input numbers while typing though - functions generally get applied to an existing value.

 

To illustrate;

 

Create Text Input TextInput1 and set the Format property to TextFormat.Number 

Create Text Label Label1

 

Set the Text property of Label1 to;

Text(Value(TextInput1.Text),"[$-en-US]###,###,###.00")

The Text() function with number formatting looks for a number to apply the formatting to, hence the Value() function wrapper.

 

What you type into the input will be replicated to the label, but with formatting.

Like I said though, formatting as you type, or pre-formatting input controls is not something I know how to do.  You could possibly put the input field over the label and make it transparent to give an effect of formatting as you type...but this could have weird results when tabbing through or selecting everything in the input control, unless it's 100% aligned.

 

Hope this helps,


RT

 

View solution in original post

3 REPLIES 3
Highlighted
Microsoft
Microsoft

Re: Force Text Input Format Number to Comma or Dot?

Hi redlyst,

 

You can try the Text() function to format numbers using commas and periods.

I'm not sure how you can format input numbers while typing though - functions generally get applied to an existing value.

 

To illustrate;

 

Create Text Input TextInput1 and set the Format property to TextFormat.Number 

Create Text Label Label1

 

Set the Text property of Label1 to;

Text(Value(TextInput1.Text),"[$-en-US]###,###,###.00")

The Text() function with number formatting looks for a number to apply the formatting to, hence the Value() function wrapper.

 

What you type into the input will be replicated to the label, but with formatting.

Like I said though, formatting as you type, or pre-formatting input controls is not something I know how to do.  You could possibly put the input field over the label and make it transparent to give an effect of formatting as you type...but this could have weird results when tabbing through or selecting everything in the input control, unless it's 100% aligned.

 

Hope this helps,


RT

 

View solution in original post

Highlighted
Helper III
Helper III

Re: Force Text Input Format Number to Comma or Dot?

@redlyst @RusselThomas @

 

You can set the default value of the inputbox with a variable, after which you set the variable to the newly input value, and then reset the value of the input text field.

On the default value of the field:

 

Set(Variable,Text(Value(TextInput1.Text),"[$-en-US]###,###,###.00"));Reset(TextInput1)

Highlighted
Helper III
Helper III

Re: Force Text Input Format Number to Comma or Dot?

Apologies, the formuyla should be on the OnChange field, and the default value of the field should be changed to the variable name

Helpful resources

Announcements
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

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
Top Kudoed Authors
Users online (4,606)