I've got a simple form which I've added a little AJAX to. The form simply let's people add users to a list. That is, I've got a textfield where people can enter an e-mail address, and that e-mail address gets added to the list.
Now, the "Add" button is AJAX enabled, meaning that the add request gets posted as an AJAX request. However, I would then like the AJAX callback function to render the form again so that the newly added user appears in the list. However, I can't really see how I should do this.
I've tried to build the form ("from scratch") using drupal_get_form() in the AJAX callback function and then return that form, but that does not work. It just gives me the error :
Notice: Undefined index: form_build_id in /home/playground/www/public_html/includes/ajax.inc on line 320
How should I go about when I would like to rebuild the form from the very scratch as a part of the AJAX request, and then return that form?