Drupal AJAX forms & commands I have a form updating with AJAX on select element change. Easy so far. The problem is that I need to return the form &amp; also an ajax command at the same time. 

If I need the form, I just return the $form array and if I need to return an ajax command I use return array('#type' =&gt; 'ajax', '#commands' =&gt; $commands);. Both works just fine.

The problem is that I don't get it how to combine both of them in the same return object.

Any ideas how can I do that?
As a backup solution, I'll do it this way:

$form['#suffix'] = '&lt;script type="text/javascript"&gt;some_function_to_do_what_i_need();&lt;/script&gt;';
return $form;


this should work.