I have four entity reference fields to user entity in a form. Host form is node edit form. Three of them are select lists, last is Inline Entity Form.
After adding a user entity via IEF I'm trying to update select lists values:
function ebep_users_feature_users_list_ajax($form, $form_state) {
$ief = array_shift($form_state['inline_entity_form']);
$options = array('_node' => t('- None -'));
$commands = array();
foreach($ief['entities'] as $data) {
$options[$data['entity']->uid] = $data['entity']->name;
}
foreach(_ebep_users_feature_getUserListFieldNames() as $fieldName) {
$form[$fieldName]['und']['#options'] = $options;
$commands[] = ajax_command_replace('#'.$fieldName.'_wrapper', drupal_render($form[$fieldName]));
}
return array('#type' => 'ajax', '#commands' => $commands);
}
It works, but when I try to add another user via IEF I am getting:
An illegal choice has been detected. Please contact the site administrator.
Related
questions on here listed to the right resolved this?