I am having a lot of trouble generating dorms dynamically using jquery.
The scenario looks like this:
I have a select list with mailing lists.
There is a onchange event in my .js file that catches the mailing list.
Based on the selected mailing list I send a $.get back to my module that gives me the member's list of that particular mailing list.
Past this step I am trying to generate a checkboxes list of members pertaining to some mailing list, with little success.
The thing that I don't know is, how to generate form elements dynamically at this step.
I tried generating the skeleton in drupal, and then using the rendered html code... I got the checkboxes, but they are not sent over after I post the form.
Help is greatly appreciated.
Comments
Without a little effort this is no going to work
Because Drupal tries to keep the unwanted out, it has safeguards in place that prevent what you want from happening.
One approach is to tell the forms API you know what you are doing and will make sure the input is valid. For this to work you still need to produce the checkboxes (even if is an empty set) with forms API and need to set '#DANGEROUS_SKIP_CHECK' to TRUE.
Another approach that may work is to try using the AHAH Forms Framework which is meant for this kind of task (I personally wish there a few more examples).