Node loses title on submit I am creating a custom module that allows for users to create blog posts that will be private and related to a project. So I created a new content_type called "tasker_blog" that just has a title and body. The user goes to view their projects and clicks a link which takes them to 'tasker_project/%/blog' % being the id of the project. I have the form being displayed correctly but when I submit the form I have two problems, 
  1) the title is lost on submit 
  2) getting this error: EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids(). 

Here is the code I have written (some non-relevant parts taken out).

function tasker_project_menu() {
    $items = array();

    $items['tasker_project/%/blog'] = array(
        'title' =&gt; 'Private Blog Post',
        'page callback' =&gt; 'drupal_get_form',
        'page arguments' =&gt; array('tasker_project_blog_form',1),
        'access arguments' =&gt; array('view tasker projects'),
        'type' =&gt; MENU_CALLBACK,
    );

    return $items;
}

function tasker_project_blog_form($form, &amp;$form_state) {
    drupal_add_css(drupal_get_path('module', 'tasker_project') . '/tasker_project.css'); 
    global $user;
    module_load_include('inc', 'node', 'node.pages');
    $node = (object) array(
        'uid' =&gt; $user-&gt;uid,
        'name' =&gt; (isset($user-&gt;name) ? $user-&gt;name : ''),
        'type' =&gt; 'tasker_blog',
        'language' =&gt; 'und',
    );
    node_object_prepare($node);

    $form = drupal_get_form('tasker_blog_node_form',$node);
    $form['hidden_project_id'] = array(
        '#type' =&gt; 'hidden',
        '#value' =&gt; arg(1),
    );

    return $form;
}


If I submit with nothing else added I get the error I mentioned above. If I add this (using Kint to display variables):

function tasker_project_node_validate($node, $form, &amp;$form_state) {
    s($_REQUEST);
    s($form_state['values']);
    die();
}


$_REQUEST array output:

array (9) (
    'title' =&gt; string (4) "test"
    'body' =&gt; array (1) (
        'und' =&gt; array (1) (
             array (2) (
                'format' =&gt; string (13) "filtered_html"
                'value' =&gt; string (13) "&lt;p&gt;test&lt;/p&gt;
"
            )
        )
    )
    'changed' =&gt; string (0) ""
    'form_build_id' =&gt; string (48) "form-eKWwyFlBOzi4LsajaAiEZBG7J0uOSI1UDVIhiDomeJE"
    'form_token' =&gt; string (43) "N421-IiWecixBJGbxTHGcJAIrd6ZutzAW0LAtVSsrJ4"
    'form_id' =&gt; string (24) "tasker_project_blog_form"
    'hidden_project_id' =&gt; string (2) "10"
    'additional_settings__active_tab' =&gt; string (0) ""
    'op' =&gt; string (4) "Save"
)


$form_state['values'] array output:

array (27) (
    'nid' =&gt; NULL
    'vid' =&gt; NULL
    'uid' =&gt; string (1) "5"
    'created' =&gt; integer 1347038959
    'type' =&gt; string (11) "tasker_blog"
    'language' =&gt; string (3) "und"
    'changed' =&gt; string (0) ""
    'title' =&gt; string (0) ""
    'additional_settings__active_tab' =&gt; string (0) ""
    'revision' =&gt; bool FALSE
    'log' =&gt; string (0) ""
    'name' =&gt; string (10) "ndenlinger"
    'date' =&gt; string (0) ""
    'status' =&gt; integer 0
    'promote' =&gt; integer 0
    'sticky' =&gt; integer 0
    'submit' =&gt; string (4) "Save"
    'preview' =&gt; string (7) "Preview"
    'body' =&gt; array (1) (
        'und' =&gt; array (1) (
             array (3) (
                'summary' =&gt; string (0) ""
                'format' =&gt; string (13) "filtered_html"
                'value' =&gt; string (13) "&lt;p&gt;test&lt;/p&gt;
"
            )
        )
    )
    //...MORE HERE REMOVED SINCE NOT RELEVANT
)


So I'm not sure if the two problems are related or not. Once the node is saved I am going to add a row to a custom table that store the nid and the project_id.
Found the solution in case anyone else ever has this issue:

    drupal_add_css(drupal_get_path('module', 'tasker_project') . '/tasker_project.css'); 
    global $user;
    module_load_include('inc', 'node', 'node.pages');
    $node = (object) array(
        'uid' =&gt; $user-&gt;uid,
        'name' =&gt; (isset($user-&gt;name) ? $user-&gt;name : ''),
        'type' =&gt; 'tasker_blog',
        'language' =&gt; 'und',
    );
    node_object_prepare($node);
    $form_state['build_info']['args'] = array($node);

    $form = drupal_retrieve_form('tasker_blog_node_form', $form_state);
    drupal_prepare_form('tasker_blog_node_form', $form, $form_state);
    $form['hidden_project_id'] = array(
        '#type' =&gt; 'hidden',
        '#value' =&gt; arg(1),
    );


I used drupal_retrieve_form and drupal_prepare_form and everything seems to work correctly now. Not sure why drupal_build_form or drupal_get_form don't work correctly.