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.querySelectorAll('texperianledq-ledq-cmp-container').forEach(element => element.setAddressCountry('MailingAddress', 'USA'));

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

document.querySelectorAll('texperianledq-ledq-cmp-container').forEach(element => element.setPhoneCodeByIso('Phone', 'USA'));