Hi, Take a look at the examples project, there is a couple of examples on how to dis this in D7, they are actually quite elegant, and usually only require a very few lines of code to do it.
http://drupal.org/project/examples I think it is example 8,9 that show this. Gordon. On 21/07/2011, at 4:31 PM, luca capra wrote: > Hi all, > I'm trying to include a form from a module trought a ajax callback on D7 [1]. > Actually I got a button #ajax-ed which load the form in a wrapper on the page. > > The form is altered in callback to make it ajax enabled, specifing #ajax > settings plus custom #submit & #validate callback. > The form loads correctly, but, when submitting, it post the whole page to > /system/ajax, on a blank page (or without ajax it post to the correct path > but not triggering the custom #submit). > > I've tryed both drupal_get_form and drupal_build_form with custom form_state > settings (eg. no_cache, rebuild) to skip/force rebuild of form (and cache). > > > Thanks in advance, > Luca > > [1] http://drupal.org/node/1218474#comment-4744608
