Global JavaScript functions

The EDQ Lightning components for both Address and Phone fields expose methods that can take an ISO standard three-letter country code and automatically switch country fields or phone code fields to that country. Those methods are:

  • setAddressCountry(isoCode) - for address components
  • setPhoneCodeByIso(isoCode) - for phone components

These can be called by Javascript on the page (e.g. in a VisualForce page) by selecting the relevant components from the DOM and directly executing the required method on the DOM element itself.

For example, when in edit mode the address component for the Mailing Address field can easily be manipulated with the following JavaScript code:

document.querySelector('[data-field-name="MailingAddress"] + texperianledq-ledq-cmp-crud-address').setAddressCountry("AUS");

The phone component for the Phone field can be manipulated with:

document.querySelector('[data-field-name="Phone"] + texperianledq-ledq-cmp-crud-phone').setPhoneCodeByIso("GBR")