Nodereference views and dynamic argument

When using views as filter and need a dynamic argument set you can't use autocomplete widget type because it uses a pre-default value that you cant change in form_alter or after_build.

If you change the widget to Select list then you can use both form_alter and after_build to set the advanced_view_args item based on arg etc.

Same goes for using PHP field in views to set a default PHP based argument, it can't get the arg list you like to have (node/[nid]/..). The arg list looks like this when using autocomlete and PHP filed:

nodereference/autocomplete/field_prd_project/n
nodereference/autocomplete/[my field name]/[what you type]

<?php

if ($form['field_prd_client'][0]['#default_value']['nid'] > 0) {
  
$form['#field_info']['field_prd_project']['advanced_view_args'] = $form['field_prd_client'][0]['#default_value']['nid'];
}

?>

Source: http://drupal.org/node/473670#comment-4515932