You are here

function wf_crm_webform_ajax::county in Webform CiviCRM Integration 7.4

Same name and namespace in other branches
  1. 7.5 includes/wf_crm_webform_ajax.inc \wf_crm_webform_ajax::county()

Populate a county list based on chosen state

Parameters

string $input:

File

includes/wf_crm_webform_ajax.inc, line 33

Class

wf_crm_webform_ajax

Code

function county($input) {
  if (strpos($input, '-')) {
    list($state, $country) = explode('-', $input);
    $params = array(
      'field' => 'county_id',
      'state_province_id' => wf_crm_state_abbr($state, 'id', $country),
    );
    drupal_json_output(wf_crm_apivalues('address', 'getoptions', $params));
    exit;
  }
}