Module Development: FormAPI and AJAX
Need to write a module that implements a form that needs some AHAH magic? Then use the awesome AHAH Helper module.
Need to write a module that implements a form that needs some AHAH magic? Then use the awesome AHAH Helper module.
Adding form fields to a Drupal form dynamically is not the most straight-forward task. You'll see this occasionally on a Drupal form (poll module jumps to mind) when there is an "add another" button that (seemingly) simply adds another set of input elements to the form. The big sticking point in setting this functionality up is doing it in a way that keeps FormAPI's security intact. Fortunately, there's some tips to get you mentally started.