I have created the following form:

function donation_amount_selection_form($form, &$form_state) {
  $form['donation-amount'] = array(
    '#type' => 'radios',
    '#options' => array('10','20','50'),
    '#default' => 0,
    '#ajax' => array(
      'calback' => 'donation_amount_selection_callback', 
      'event' => 'click',
  $form['donation-custom-amount'] = array(
    '#type' => 'textfield',
    '#title' => 'Other',
    '#ajax' => array(
       'callback' => 'donation_amount_selection_callback',
  $form['submit'] = array(
    '#type' => 'submit',
    '#title' => 'Submit',
    '#value' => 'submit',
  return $form;

I have put an ajax calllback on each of the form elements. The callback for the textfield gets fired but not the one on the radio buttons. I even tried commenting out the callback for the textfield to see if somehow it was interfering with the radio buttons (because its the same callback function), but it still didn't work.

  • Try removing event from radios, letting it be default too. Also, is AJAX HTTP request never sent, or it's sent but achieves nothing? – Mołot Nov 19 '13 at 14:31
  • It didn't work without event, thats why I tried adding it. And the request isn't sent – user1015214 Nov 19 '13 at 14:41
  • So try adding 'change' to the list of events. Works for checkboxes, so maybe? – Mołot Nov 19 '13 at 14:42
  • Note that you have written caLback instead of callback! 'calback' => 'donation_amount_selection_callback', probably this is the problem :) – Enxebre Nov 19 '13 at 15:00
  • Ah, thats probably it! I just can't check now because my site just died. But I'm sure thats it. Thanks! – user1015214 Nov 19 '13 at 15:08

Your Answer

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

Browse other questions tagged or ask your own question.