In my form I create a field of type list (with the widget box is checked). By default, this field has no value.
In my hook_form_alter () method, I add options (via PHP) has this field.
$form['field_genric_domains']['und']['#options']= _get_domaine_options();
if($form['field_genric_domains']['und']['#default_value'] == NULL){
$form['field_genric_domains']['und']['#default_value'] = array(_get_this_domain_id());
}
Then I set a default value. I set up a test that shows whether we are editing or creating.
When creating, it works perfectly, but when editing the table (# default_value) is empty. Normally it should contain the values previously inquire.
Why? Thank you for your help