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

Substituting commas for dots on text entry

Hello, i would like to make a field subsitute "," for "." on text entry, or on submission of the form.
The field is called DataCardValue11
I have tried adding this: Substitute(DataCardValue11.Text,",",".") to the "OnChange" and "OnSelect" of the field and it dosnt work...
I have also tried adding that to the "OnSave" of the SharepointIntegration object, and it dosnt work also.
Nothing ever happens and no errors 🙄

Thank you!

10 REPLIES 10
Krishna_R
Responsive Resident
Responsive Resident

Hi @ratapof29 

instead of onchange, have you tried keeping it in update property of the datacard

Substitute(DataCardValue11.Text,",",".")

DylanSimons
Resolver III
Resolver III

You should create a variable, something like InputText_var and set it to blank to begin, unless it should already have data on startup.

 

Something like this on the OnVisible property: UpdateContext({InputText_var:""})

 

 

Next, use this variable as the Default property of DataCardValue11.

 

Next, much like you have already tried - in the OnChange property of DataCardValue11 put the following:

 

UpdateContext({InputText_var: Substitute(DataCardValue11.Text,",",".")})

replying to Krishna_R, nope, it dosnt work either

ratapof29_0-1625067331615.png

when i run the app and type for example "123,123" it stays there and dosnt change

i am now trying to do this on a seperate blank app with only one text field, and it still dosnt work

ratapof29_1-1625067626639.png

what is the correct way of accomplishing this?

zmansuri
Super User
Super User

a1.jpg

Default property of the TextBox:

Substitute(Parent.Default,",",".")

if you enter Ankit,Patel it will save as Ankit.Patel

Ah, you also need to reset the control for the default to replace the current value. So the OnChange action would be like this:

 

UpdateContext({InputText_var: Substitute(DataCardValue11.Text,",",".")});

Reset(DataCardValue11)

You are doing it on Update property. I did it on default property. Works for me.

Replying to @DylanSimons, i have now done that and it works BUT now when i load the form in edit mode, (to edit an existing item instead of creating one) it is not the right value shown in that field anymore...
how should i correct this?
Thank you!

@zmansuri , i was replying to Krishna_R,

i now tried your solution and it dosnt work. still nothing happens when i enter text in the field and click elsewhere, nothing changes (i have to had Text(...) because the field type is a number. i just want to let users be able to enter either a comma or a dot as decimal separator)

ratapof29_0-1625071708582.png

What am i missing?

 

a5.jpga6.jpg

I tried it on update property. It works.

I entered data as Tes,Test,Test

it saved as Test.Test.Test

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,584)