node reference fail before submit
if ($form_id == 'register_node_form'){
    global $user;
    if(isset($form_state['build_info']['args'][0]-&gt;field_event_ref[LANGUAGE_NONE][0]['nid'])){
       $nid = $form_state['build_info']['args'][0]-&gt;field_event_ref[LANGUAGE_NONE][0]['nid'];
    }  else {
    $nid = $form_state['build_info']['args'][0]-&gt;field_event_ref[LANGUAGE_NONE][0]['nid'] = arg(3);
    }
     $form_state['build_info']['args'][0]-&gt;field_event_ref[LANGUAGE_NONE][0]['nid'] = $nid;