Insites Docs Web Components V2Data EntryTel

Tel

Published on February 17, 2021, updated on July 06, 2021

Element: <ins-input-tel>

Defines an input field where user can enter phone number data.

Complete Example

Code Snippet

<ins-input-tel label="Phone"
  areacode-placeholder="Area Code"
  areacode-value="1300"
  phonenum-placeholder="Phone Number"
  phonenum-value="12345"
  tooltip="This is a sample tooltip content. It also support html content.">
</ins-input-tel>
No Area Code Example

Code Snippet

<ins-input-tel label="Phone"
  no-areacode
  phonenum-placeholder="Phone Number"
  phonenum-value="12345">
</ins-input-tel>
Default Field

Code Snippet

<ins-input-tel
  label="Phone"
  areacode-placeholder="Area Code"
  areacode-value="1300"
  phonenum-placeholder="Phone Number"
  phonenum-value="12345">
</ins-input-tel>
Default State

Code Snippet

<ins-input-tel></ins-input-tel>
Error State

Code Snippet

<ins-input-tel 
  has-error error-message="This is a required field">
</ins-input-tel>
Direct Set Data

Code Snippet

<ins-input-tel 
  id="directSetDataInputtel">
</ins-input-tel>

<script>
  var label_inputtel = 'Telephone',
      areaCode = '130',
      phoneNum = '636991';

  var phoneField = document.getElementById('directSetDataInputtel');
  phoneField.addEventListener('didLoad', function(e){
    // Update `label` attribute of the element
    phoneField.setAttribute('label', label);

    // Update `countryCode` attribute of the element
    phoneField.setCountryCode('+1');

    // Update `areacodeValue` attribute of the element
    phoneField.setAttribute('areacode-value', areaCode);

    // Update `phonenumValue` attribute of the element
    phoneField.setAttribute('phonenum-value', phoneNum);
  });
</script>
Static Data Source

Code Snippet

<ins-input-tel 
  label="Phone" 
  areacode-value="1300" 
  phonenum-value="12345">
</ins-input-tel>
Label Attribute

Code Snippet

<ins-input-tel 
  label="Phone">
</ins-input-tel>
Area Code Attribute

Code Snippet

<ins-input-tel 
  areacode-value="1300">
</ins-input-tel>
Phone Number Attribute

Code Snippet

<ins-input-tel 
  Phonenum-value="12345">
</ins-input-tel>
Events - insInputTelChange

Code Snippet

<ins-input-tel
  id="insValueChange"
  label="Phone"
  areacode-placeholder="Area Code"
  phonenum-placeholder="Phone Number">

</ins-input-tel>

<p id="demo"></p>
<p id="demo1"></p>

<script>
const insInputTelChange = document.getElementById('insValueChange')
insInputTelChange.addEventListener('insValueChange', event => {
  console.log(event);
  console.log(event.detail.field);
  console.log(event.detail.value);
  if (event.detail.field == "area_code") {
    document.getElementById("demo").innerHTML = event.detail.field + event.detail.value;
  } else {
    document.getElementById("demo1").innerHTML = event.detail.field + event.detail.value;
  }
});
</script>

 

Attributes

 

FIELD ATTRIBUTE TYPE DEFAULT OPTIONS DESCRIPTION
label string "" any Defines label of input field
areacode-placeholder string "" any Defines the short hint that describes the expected value in the area code input field
areacode-value string "" any Defines the value of an area code input element
phonenum-placeholder string "" any Defines the short hint that describes the expected value in the phone number input field
phonenum-value string "" any Defines phone number value
country-code string "" any Defines countryCode value
area-code string "" any Defines name of area code input field
phone-number string "" any Defines name of phone number input field
error-message string "" any Defines the error message when input element is wrong
required boolean false true, false Specifies that the input field must be filled out before submitting the form
has-error boolean false true, false Specifies validation or mandatory input for the input field
disabled boolean false true, false Disables input field
readonly boolean false true, false Specifies that the input field is read-only
no-areacode boolean false true, false Removes the area code field
tooltip string "" - Displays a tooltip beside the label. Supports HTML Content

 

Events

 

EVENT OBJECT DESCRIPTION
insInput field, value Returns value when an element gets user areacode or phone number input
insValueChange value Emits the value on change

 

Methods

 

METHOD PARAMETERS DESCRIPTION
getValue None Returns the formatted value of the field
getCountryData None Returns the data of the selected country
setCountryData countryCode: String Programmatically set the country code of the field.

 

Have a suggestion for this page?

Didn't quite find what you are looking for or have feedback on how we can make the content better then we would love to hear from you. Please provide us feedback and we will get back to you shortly.