How to use form_set_value for a select list field? Drupal 7. in my validate form function, I use form_set_value to set the value for the field "statut_metier" to 'draft'

If my field is a text field, this code works : 

form_set_value($form['field_statut_metier'][LANGUAGE_NONE][0]['value'], 'draft', $form_state);


If my field is a list(text) field, with the key for the value 'draft' = 5

I can't manage to have the form_set_value function work.

Using Devel and dpm() I have search to reach this field value :

I have tried :

form_set_value($form['field_statut_metier2'][LANGUAGE_NONE]['#value'][0], '5' , $form_state);


but it doesn't work.

Any idea ?
&lt;?php form_set_value($form['field_statut_metier2'][LANGUAGE_NONE], array(0 =&gt; array('value' =&gt; 2)), $form_state); ?&gt;


From the form_set_value() documentation on the first argument:


  you can just pass in the element from the $form array, although the only component that is actually used is '#parents'


Alternatively you can do:

&lt;?php $form_state['values']['field_statut_metier2'][LANGUAGE_NONE][0]['value'] = '2'; ?&gt;


... which is what form_set_value() does anyways.