How can I dynamically add drupal behaviors to a form from php using ajax?
Yes you can attach Drupal Behaviors to newly added elements (DOM nodes):

You can check ahah.js (in Drupal.ahah.prototype.success):

// Attach all javascript behaviors to the new content, if it was successfully
// added to the page, this if statement allows #ahah[wrapper] to be optional.
if (new_content.parents('html').length &gt; 0) {
  Drupal.attachBehaviors(new_content);
}


Or if your script creates the elements (answer on stackoverflow about drupal-behaviours):

var newNodes = $('&lt;a href="#"&gt;Hello&lt;/a&gt; &lt;a href="#"&gt;World&lt;/a&gt;').appendTo('#someDiv');
Drupal.attachBehaviors(newNodes);