Advertisement
Guest User

Untitled

a guest
Jul 30th, 2015
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. success: function (response) {
  2.  
  3.         var emailFound = false;
  4.  
  5.             $.each(Drupal.settings.webform_represent.lookups, function (form_key, data) {
  6.               var $component = $('#webform-component-' + form_key.replace('_', '-')),
  7.             $input = $('#edit-submitted-' + form_key.replace('_', '-'));
  8.  
  9.               $component.find('.webform-represent-alert').remove();
  10.  
  11.               $('#webform-component-' + form_key.replace('_', '-'), context).show();
  12.  
  13.               var emails = response[data.options_source];
  14.               // For now, if multiple representatives match, use the first.
  15.               if (emails) {
  16.                 $input.val(emails[0]);
  17.         emailFound = true;
  18.                 return false; // break out of loops, we already have a match
  19.               }
  20.             });
  21.  
  22.     if(!emailFound){ // If we didn't find any matches
  23.                 blockError(errorContainer, Drupal.t('We were unable to find your representative by postal code. Please select from the list below.'));
  24.        
  25.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement