i want to save checkboxes values in entity reference checkboxes field with node_save :

   $form['wrapperrr']['id_offre'] = array(
        '#title' => t('Liste des Offres'),
        '#type' => 'checkboxes',
        '#options' => $optionsoffres,


and into the submit button :

$node->field_entity_reference['und'][]['value'] =$form_state['values']['wrapperrr']['id_offre'];

1 Answer 1


i found the solution :

  $aaz= array_filter($form_state['values']['wrapperrr']['id_offre']);
 foreach($aaz as $of)

  //  $node->title = $form_state['values']['wrapperrr']['id_offre'][0]['value'];     
   $node->field_offre[LANGUAGE_NONE][]['target_id'] = $of;


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.