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:
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'];
}
$form['states_views_exposed_form']
in the AJAX callback and add$form['country_views_exposed_form']
in the form.