cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Text input formatted as number strips leading zero on submit

I'm saving a phone number as text to SharePoint list (no reason to save as number as I'm not calculating anything off it).

 

To avoid the user putting actual text instead of numbers, I've formatted the input field as TextFormat.Number.

The SharePoint field type is text.

 

The problem is, the update back to SharePoint is stripping any leading 0's....

I've tried changing the Update field of the card to Text(inputfield.text) but it still does it.


Any ideas?

 

Kind regards,

 

R

6 REPLIES 6
JRaasumaa
Memorable Member
Memorable Member


@Anonymous wrote:

I'm saving a phone number as text to SharePoint list (no reason to save as number as I'm not calculating anything off it).

 

To avoid the user putting actual text instead of numbers, I've formatted the input field as TextFormat.Number.

The SharePoint field type is text.

 

The problem is, the update back to SharePoint is stripping any leading 0's....

I've tried changing the Update field of the card to Text(inputfield.text) but it still does it.


Any ideas?

 

Kind regards,

 

R


Can you force the patched format to include the leading 0 using the text format command?

 

For example you can force a leading 0 onto a number value field being patched by using:

Text(Value(TextInput1.Text),"0000")

So if my input field is:  234

My text input will become: 0234

 

Anonymous
Not applicable

It seems it's being stripped by the TextFormat.Number type, so I'm trying to add zeroes where none exist.

 

[edit-correction]

sorry, forgot to pad it more - busy testing

 

[edit]

Nope, still strips the leading zero. Bizarre

 


@Anonymous wrote:

It seems it's being stripped by the TextFormat.Number type, so I'm trying to add zeroes where none exist.

 

[edit-correction]

sorry, forgot to pad it more - busy testing

 

[edit]

Nope, still strips the leading zero. Bizarre

 


Can you provide an example of your input field and patch command? I've done a few tests and patching using: 

Text(Value(TextInput1.Text),"0000")

 works to produce a leading 0

 

 

Anonymous
Not applicable

Hi JRaasumaa,

 

Sorry, it's part of a form and I'm using Submit, so if patch works then it might be Submit that's causing it - and I really don't want to patch 30-odd fields, or even submit and then repatch 1...messy.

 

Current workaround is to revert to standard TextFormat.Text and include a regex pattern match to warn the user about text in a number field - but I'd really like to understand where and how the stripping is happening.


Thanks

 

R

Anonymous
Not applicable

Hi @Anonymous

 

I tried to do the same just having an simple SharePoint List with text. Adding and Edit Form, unlocking the text field and changing Format to TextFormat.Number

 

I try to enter 001234 and click submit (which has function SubmitForm(Form1)) in the SharePoint list all the 00 are there and it is displayed as 001234 not 1234.

 

It might be some other setting that is affecting the outcome.


@Anonymous wrote:

Hi @Anonymous

 

I tried to do the same just having an simple SharePoint List with text. Adding and Edit Form, unlocking the text field and changing Format to TextFormat.Number

 

I try to enter 001234 and click submit (which has function SubmitForm(Form1)) in the SharePoint list all the 00 are there and it is displayed as 001234 not 1234.

 

It might be some other setting that is affecting the outcome.


 

Is it possible Sharepoint isn't really storing it as text in his list?

 

@Anonymous can you test the same thing on a new Sharepoint column to see if it still happens? It sounds like @Anonymous tested it better than I did and my guess is something wrong with the list.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Ideas

Check out the New Ideas Site

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (4,281)