1

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'];
}
  • 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. – kiamlaluno Apr 30 '13 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 '13 at 6:32
2

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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