2

I have 2 modules. Let's call them Publisher and Publication for discussion's sake.

Publication module requires Publisher module. Publisher module provides form to edit publisher's data. Publication module provides list of publications with reordering and adding capability, and it can be limited to display only publications by one publisher.

Now, I want to nest publisher's publications form at the bottom of his data edit form. I would prefer to avoid writing same code again - I want to keep validation functions and submit functions as they are now, just have it on one screen, with one submit button.

Subform seems to be unmaintained and buggy at this point and Multiple forms seems to skip validations altogether, that makes both of them unusable for me.

  • 1
    Look what i found drupal.org/project/subform – niksmac Jun 6 '13 at 9:28
  • @NikhilM Oldest open bug is 1 year 51 weeks old and at least 2 of 5 open bugs would interfere with my forms in a way it would probably render it unusable. Otherwise, good call. – Mołot Jun 6 '13 at 9:31
3

You can use the admin/content page as a reference to combine forms. There, the filter form and overview form are passed as elements in a new $form array.
Coming from the content administration callback function in the node.admin.inc file:


/**
 * Menu callback: content administration.
 */
function node_admin_content($form, $form_state) {

  $form['filter'] = node_filter_form();
  $form['#submit'][] = 'node_filter_form_submit';
  $form['admin'] = node_admin_nodes();

  return $form;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.