I am trying to add a new field in a preexistent form and invoke a callback. The response of the callback is alway an error with an empty response:

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /system/ajax
StatusText: OK

ResponseText is always empty.

The code I use in my_form_form_alter() is the following.

$form['country_views_exposed_form'] = array(
  '#type' => 'select',
  '#title' => t('Country'),
  '#options' => array(
    'sl'  => 'Select...',
    'au'  => 'Australia',
    'nz'  => 'New Zealand'
  '#ajax' => array(
    'callback' => '__my_callback',
    'wrapper' => 'country-views-exposed-form-wrapper-',
    'method' => 'replace',
    'event' => 'change'
  '#attributes' => array('class' => 'views-exposed-widget')

All I put in __my_callback() produces the same result: I don't get a clean response.

function __my_callback(&$form, &$form_state) { 
  return $form['states_views_exposed_form'];
  • I don't know if that is a typo, but you return $form['states_views_exposed_form'] in the AJAX callback and add $form['country_views_exposed_form'] in the form.
    – apaderno
    Apr 30, 2013 at 6:20
  • @kiamaluno tnx but is not a typo. when change 'country_views_exposed_form', 'states_views_exposed_form' is populated with new data
    – vincenzodb
    Apr 30, 2013 at 6:32

1 Answer 1


I have resolved. Exposed form fields don't are the same of 'normal' form fields in drupal. I have applied the patch #46 listed here: http://drupal.org/node/1183418

  • Please mark your own answer as the correct answer so other people know that is the good answer without reading it.
    – sanzante
    Jul 6, 2014 at 12:42
  • ok, tnx for the suggestion
    – vincenzodb
    Jul 7, 2014 at 9:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.