How can i check which radio button has been checked from a list of radio buttons ? Is there any key in the form array which holds the checked radio ?

I am using an ajax call for a bunch of radios buttons and i would like to do some "checking" only if the right radio button was selected.

As an alternative , how can i append the "#ajax" parameter to only one radio button in a list of radio buttons ?

  • Tell us what your trying to achieve?
    – Alex Gill
    Jan 9 '13 at 11:50
  • @AlexGill was i clear enough ?
    – Vlasin
    Jan 9 '13 at 11:55

You can check the element's value in $form_state['values']. Add the full parameter list ($form, &$form_state) to the form builder function.

For example: function mymodule_something_form($form, &$form_state) {


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.