If you are using drupal 6 and facing this situation :

I have a AHAH button that will fetch a part of a form, then in that part of fetched form another ahah button exist. Also the new fetched part of the form will replace the first AHAH button

Then the problem will occurs :

The first AHAH button is working but when the newly fetched form content replaced it, the new AHAH button in the newly created form content failed to utilize AHAH, instead it work just like a normal button

If those are the case then most likely you are facing Drupal 6 AHAH loop bug, Don't bother to look around or trying to fix the form. The problem is on the ahah.js itself.

The ahah.js only registering the first ahah button and when the second button comes up. the ahah.js will not repopulate the DOM and register the second button.

You can learn more about this issue in http://drupal.org/node/507108

To fix this problem in your custom module, one need to fetch quicktabs module and get its quicktabs_ahah.js.

Then you need to load the quicktabs_ahah.js (wisely to rename it first) in your custom module and the problem will be fixed.

As stated in http://drupal.org/node/507108 this problem will not go away or patched in drupal 6 but hopefully since drupal 7 patch is there the problem will not exist in drupal 7.