Phone input control type

This control type can be used to provide an user friendly way of entering phone numbers for many countries, showing examples / invite messages that depend on the selected country.

In runtime, the control contains two components: a country selector and an editable field. If a number using the international format is entered into the editable field directly, the country selector will be updated automatically to show the number's country.

PhoneInputSample
Phone input sample

The recommended data type for variables/attributes using this control is Varchar, 30 or greater length.

The value returned by the control is always the number using the international format. The developer can get the number as entered by the user using the "NationalNumber" property.

Properties

Category Name Value
General National Mode Determines if the user can enter phone numbers as accustomed in each region, instead of using the international format always.
Placeholder Number Type Determines if the placeholder shown to the user will correspond to the mobile number template for the region or the landline.
Auto placeholder Determines if the placeholder determined by the control should overwrite the Invite message from the variable.

Runtime properties

Category Name Value
General Contains Valid Number Contains a boolean value indicating if the number matches a known format or not.
International Number Contains the phone number entered by the user formatted using the international format.
National Number Contains the phone number entered by the user formatted as entered by the user.

Methods

The control supports methods to handle which countries are available / selected. In all cases, country codes must be specified using the ISO 3166 format.

  • SetDefaultCountry(countryCode): sets the country selected in the control. This country can be changed by the end user.
  • SetAvailableCountries(countryCodes): sets the list of countries that must be shown in the control. The user can only select one of those countries. The parameter passed to this method should be a collection of character.
  • SetPreferredCountries(countryCodes): sets the list of countries that are shown in the control at the top of the list. This can be useful to select countries used frequently by the user in the application. The parameter passed to this method should be a collection of character.

Example:

&Countries.Add('br') 
&Countries.Add('ar') 
&Countries.Add('uy') 
&Phone.SetAvailableCountries(&Countries) 
&Phone.SetDefaultCountry('br')

In this example, the options shown in the control are Argentina, Brazil, and Uruguay. The variable Phone is the one that has the phone input control type, the Countries variable is defined as a collection of type CHARACTER.