242
Views
11
Comments
how to prefix country code to phone no
Question

hi,      

           when user enter phone no  in a textbox and select country code the country code should be prefixed to phone no.how we can concatenate


Inline image 1

2023-12-07 07-51-40
Remco Dekkinga
 
MVP

Hi Karthik, the image you added is not showing. Can you please update your post with a working image?

UserImage.jpg
karthimani R

Remco Dekkinga wrote:

Hi Karthik, the image you added is not showing. Can you please update your post with a working image?



2023-12-07 07-51-40
Remco Dekkinga
 
MVP

Hi Karthik,

First of all, use a field for the phone number in the database without prefix and a field for the country prefix. It's easier to work with.

The fields can be concatenated by doing the following: 

FullPhoneNumber = CountryCode + PhoneNumber

Kind regards,

Remco Dekkinga

UserImage.jpg
karthimani R

Remco Dekkinga wrote:

Hi Karthik,

First of all, use a field for the phone number in the database without prefix and a field for the country prefix. It's easier to work with.

The fields can be concatenated by doing the following: 

FullPhoneNumber = CountryCode + PhoneNumber

Kind regards,

Remco Dekkinga


hi remco,

               Thank you for your reply .In a text box how we can concatenate by adding expression and also i want user to enter the phone no and after selecting code ,code should be prefixed.it should happen in same input box



2023-12-07 07-51-40
Remco Dekkinga
 
MVP

Be aware that if you use the same variable for the phonenumber and the full phonenumber, that on every OnChange of the country the new country code is added in front of the phonenumber, you will end up with something like: +315+350123456789 which is a result that you don't want.

The textbox for the full phonenumber should have a variable behind it.

In the combobox (country-selector) you create an OnChange action that will trigger a new action.

Inside this action you concatenate the country code with the phonenumber and assign it to the variable that you use for the full phonenumber. After concatenation, do an ajax refresh on the full phonenumber.

As far as UX, try to create a screen where the user can enter the fields separately (CountryCode and PhoneNumber) and on all screens where you show or use the number use the concatenated full phonenumber.

This way it's simple for the end user to edit his phonenumber and for the other system users to use the number.

Kind regards,

Remco Dekkinga


UserImage.jpg
karthimani R

Remco Dekkinga wrote:

Be aware that if you use the same variable for the phonenumber and the full phonenumber, that on every OnChange of the country the new country code is added in front of the phonenumber, you will end up with something like: +315+350123456789 which is a result that you don't want.

The textbox for the full phonenumber should have a variable behind it.

In the combobox (country-selector) you create an OnChange action that will trigger a new action.

Inside this action you concatenate the country code with the phonenumber and assign it to the variable that you use for the full phonenumber. After concatenation, do an ajax refresh on the full phonenumber.

As far as UX, try to create a screen where the user can enter the fields separately (CountryCode and PhoneNumber) and on all screens where you show or use the number use the concatenated full phonenumber.

This way it's simple for the end user to edit his phonenumber and for the other system users to use the number.

Kind regards,

Remco Dekkinga



how to concatenate in action whether we can add expression in the flow




2023-12-07 07-51-40
Remco Dekkinga
 
MVP

Hi Karthik,

Use an assign (=) in your flow.

Variable: FullPhoneNumber

Value: CountryCode + PhoneNumber

And add an ajax refresh for the FullPhoneNumber textbox.

Kind regards,

Remco Dekkinga


UserImage.jpg
karthimani R

Remco Dekkinga wrote:

Hi Karthik,

Use an assign (=) in your flow.

Variable: FullPhoneNumber

Value: CountryCode + PhoneNumber

And add an ajax refresh for the FullPhoneNumber textbox.

Kind regards,

Remco Dekkinga


yes i added assign operator but after entering phone no and when i select country code from combo box the phone number disappears in text box and only country code is visible



2023-12-07 07-51-40
Remco Dekkinga
 
MVP

Hi Karthik,

Then you are using the wrong variable for the phonenumber in the assign.

Can you share your eSpace (.oml)?

Kind regards,

Remco Dekkinga

2023-12-11 06-11-39
Mohammad Shad

Hi @Remco Dekkinga,


Can you provide videos or proper documentation regarding this.


Thanks & Regards,

Mohammad Shad

2025-09-04 06-33-37
Nikhil___Vijay

Hello @R.kar 

There are a few assets available on the forge that do this, like the International Telephone Input Reactive, which features a demo for you to see how to works.

Regards 

Nikhil kumar vijay


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.