I joined this 2 form and the current submit only works for the 2nd form... also it is showing an extra save button :( can anyone help me how to join the submit,preview and delete button?

here is my code :

function productform_form_alter(&$form, &$form_state, $form_id) {

switch ($form_id)  {
  case 'product_node_form':

    global $user;
    $uid = $user->uid;

    module_load_include('inc', 'profile2_page', 'profile2_page');
    $profile2 = profile2_by_uid_load($uid, 'main');
    $entity_form = entity_ui_get_form('profile2', $profile2, 'edit');

    $form[] = $entity_form;


    return $form;


  • This is definitely not how the FAPI should be used. Please provide more information about your requirements.
    – BetaRide
    Jul 17, 2012 at 11:11
  • I need to join 2 forms into one page form, one is product content type and the other is profile2 called main. I wanted to join them into 1form. please help
    – Boby
    Jul 17, 2012 at 11:25

1 Answer 1


I'd sugest to build your own form using FAPI and create the nodes programmatically in the submitthandler.

Looking at what you get in hook_form_alter has of course a good learning effect.

  • any pin point example please, I am really newbie at this :(
    – Boby
    Jul 17, 2012 at 13:14
  • Did you read the first two sentences in the above FAPI link? It has a link to the Form API Quickstart Guide. The examples module (drupal.org/project/examples) is also very handy.
    – BetaRide
    Jul 17, 2012 at 13:20
  • sorry for missing that part, quick question, am I able to pull the fields as it is already created in content type and profile 2?
    – Boby
    Jul 17, 2012 at 17:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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