cancel
Showing results for 
Search instead for 
Did you mean: 

Text Formats for Data Entry

Every application that requires data input, will have a business case for entering text and numbers in a desired format. Currently, the only options in the Text control are the Format property (Text, Number) and Maxmimum Length. 

 

We need to be able to selected common formats like SSN, Phone Number, Decimal, Currency, etc. and to specifiy patterns for business specific formats, such as an account number that use two alpha a dash and 4 numbers AA-####. You can implement Regular Epxressions or pick any of the languages that support some form a FormatText() function.

 

The best UI designs give immediate feedback to the user and limit the data entry of a value to the desired format should be a base functionality with any text control.

 

Along with the formatting we also need properties to read/update the the raw value (unformatted) or the formatted value. This way you can decide which version you want to save in the database, and setting the RawText property from a database column that saves only the digits of a phoner number would properly show the (999) 999-9999 format in the control.

 

Please consider moving this up, Everyone please vote it up and comment below with other ideas and need for properly formatting your data entry needs.

Status: New

Hi @mcolbert,

Can you share more about the experience you're expecting? For instance, for a social security number, are you imagining a single text input box with dashes as you type?

Comments
mr-dang
Community Champion
Status changed to: New

Hi @mcolbert,

Can you share more about the experience you're expecting? For instance, for a social security number, are you imagining a single text input box with dashes as you type?

mcolbert
Advocate V

HI @mr-dang,

 

I would expect something like the following;

  • Format would look like '###-##-####' or following regular expressions used by IsMatch() it would look like
^\d{3}-\d{2}-\d{4}$
  • when the Text value of the control is blank the text control should display "   -  -    "
  • then as the user types the 9 digits, the dash stays in place, "123-4 -     "
  • So a completed SSN would look like 123-45-6789 asnd the unformatted version removes all of the literal characters and would look like 123456789.

Seems like leveraging regular expressions (and some of the Match enum in IsMatch() provides the utmost flexibility and is a standard. I see in Docs that PowerApps uses the JavaScript dialect

 

Thanks! Hope this helps.

 

rampart
Regular Visitor

IsMatch() is supported in canvas apps only. In model-driven apps you need some custom event-driven Javascript. But if you want to validate against a format in Dataverse, where it probably should be, there is currently no way to do this, without writing or using a custom connector in a complex Automate action (possibly paid!).

 

I think the best way to implement this would be to change the StringAttributeMetadata.FormatName functionality to use a mask/regex rather than a hardcoded set of validators/formatters at present.