I'm trying to set value of select list programmatically with hook form alter

I have select list with options:

$options = array(125 => 'USA');

and setting value like this

$form['field_news_rubrique']['und']['#options'] = $options

But this don't work.

if i change options like this

$options = array(0 => 'USA');

it's working

if i have multiple value in options like this :

$options = array(124=> 'EN', 125 => 'USA');

it's working too

  • I'm get it working by disable taxonomy term permission module
    – stomerfull
    Jul 10, 2014 at 15:18

1 Answer 1


Do you want to set the value before submission or after?

Before submission: Use $form and set the default value for the select list using the key.

After submission: Use $form_state['values']

  • I want to set value before submission , but i get it working thank's for your post
    – stomerfull
    Jul 14, 2014 at 9:41

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.