Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- success: function (response) {
- var emailFound = false;
- $.each(Drupal.settings.webform_represent.lookups, function (form_key, data) {
- var $component = $('#webform-component-' + form_key.replace('_', '-')),
- $input = $('#edit-submitted-' + form_key.replace('_', '-'));
- $component.find('.webform-represent-alert').remove();
- $('#webform-component-' + form_key.replace('_', '-'), context).show();
- var emails = response[data.options_source];
- // For now, if multiple representatives match, use the first.
- if (emails) {
- $input.val(emails[0]);
- emailFound = true;
- return false; // break out of loops, we already have a match
- }
- });
- if(!emailFound){ // If we didn't find any matches
- blockError(errorContainer, Drupal.t('We were unable to find your representative by postal code. Please select from the list below.'));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement