Type: function

By default, the contact picker displays any contacts that have one or more email addresses. This is typically great if you are using the contact picker in a context that requires an email address. However, you might want to change this if you are interested in other data, like mailing addresses or if you want to even further restrict the choices of the user. Enter the filter option.

This option lets you decide which contacts are displayed in the contact picker by providing your own function that will decide whether to show it or not.

Your filter function must accept a contact object and return true to have it included in the display.

For example, to include contacts with an email address with an “example.com” domain:

cloudsponge.init({
  filter: function(contact) {
    return !!(contact.email && contact.email.find(function(email) {
      return email.address.match(/@example.com$/);
    }));
  }
});

Our default filter function returns true if there is at least one email associated with the contact:

cloudsponge.init({
  filter: function(contact) { return !!contact.email.length }
});

Try CloudSponge for free in your
testing environment

Get a Free Sandbox Account

Have a questions or prefer a guided tour?
Schedule a consultation with our Founder.