2

I want to render form in drupal separately, item by item.

function form($form){

$form['item1'] = array(
'type' => 'textarea',  .........etc

$form['item1'] = array(
'type' => 'textarea',  .........etc

$form['submit'] = array(
'type' => 'submit',  .........etc
}

$a = drupal_get_form('form');

drupal_render($a['item1']);

drupal_render($a['item2']);

drupal_render($a['submit']);

form is rendered successfully, but it seems that submit button not work (not call submit function)

Any help?

Thanks

Laky
  • 745
  • 2
  • 12
  • 25

1 Answers1

3

You just need to call drupal_render() one more time:

drupal_render($a);

It won't re-render everything you previously rendered.

popthestack
  • 496
  • 3
  • 7
  • still not working, I forgot to tell that between each item there is another form – Laky Jan 03 '12 at 23:11
  • You can't embed a form within a form. See: http://stackoverflow.com/questions/1759006/embed-an-html-form-within-a-larger-form – popthestack Jan 03 '12 at 23:18