2

I have a form with multiple select elements with an #ajax callback on change. The ajax is working but the problem is that I can't figure out how to find which select has triggered the ajax. All ajax callbacks point to the same function.

Any ideas on how to find which select was changed?

Thanks.

1
  • Got a code sample?
    – WestieUK
    Mar 20 '12 at 16:10
1

You should be able to make the distinction by checking $form_state['triggering_element']:

switch ($form_state['triggering_element']['#name']) {
  case 'select1':
    // Do something
    break;
  case 'select2':
    // Do something
    break;
  // ...
}
0

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.