function _webform_addressfield_country_validate in Addressfield Tokens 7
Validates a country, and if changed, rebuilds the form for the new country.
1 string reference to '_webform_addressfield_country_validate'
- _webform_render_addressfield in ./
addressfield_tokens.components.inc  - Render a Webform component to be part of a form.
 
File
- ./
addressfield_tokens.components.inc, line 229  - Webform Component information for an address field type.
 
Code
function _webform_addressfield_country_validate(&$element, &$form_state) {
  // If the country was changed, rebuild the form.
  if (!isset($element['#default_value']) || $element['#default_value'] != $element['#value']) {
    $form_state['rebuild'] = TRUE;
  }
  $cid = $element['#cid'];
  $parents = $element['#parents'];
  array_pop($parents);
  // Search through the form values to find the current address.
  $address = drupal_array_get_nested_value($form_state['values'], $parents);
  _webform_addressfield($cid, $address);
}