Skip to main content
replaced http://drupal.stackexchange.com/ with https://drupal.stackexchange.com/
Source Link

I got the solution from Save a new value with entity_metadata_wrapper to an entity field which is an arraySave a new value with entity_metadata_wrapper to an entity field which is an array.

I created two separate form fields.

function createnode_form($form, &$form_state){ 
  $form['field_student_age'] = array(
    '#type' => 'textfield',
    '#title' => t('test'),
  );

  $form['field_student_age2'] = array(
    '#type' => 'textfield',
    '#title' => t('test2'),
  );

Then I stored them using the first method in the post quoted above.

$ewrapper->field_student_age[] = $form_state['values']['field_student_age'];
$ewrapper->field_student_age[] = $form_state['values']['field_student_age2'];

Rather than using set as I'd done with single values, I created a new entry for each value using [] =.

I got the solution from Save a new value with entity_metadata_wrapper to an entity field which is an array.

I created two separate form fields.

function createnode_form($form, &$form_state){ 
  $form['field_student_age'] = array(
    '#type' => 'textfield',
    '#title' => t('test'),
  );

  $form['field_student_age2'] = array(
    '#type' => 'textfield',
    '#title' => t('test2'),
  );

Then I stored them using the first method in the post quoted above.

$ewrapper->field_student_age[] = $form_state['values']['field_student_age'];
$ewrapper->field_student_age[] = $form_state['values']['field_student_age2'];

Rather than using set as I'd done with single values, I created a new entry for each value using [] =.

I got the solution from Save a new value with entity_metadata_wrapper to an entity field which is an array.

I created two separate form fields.

function createnode_form($form, &$form_state){ 
  $form['field_student_age'] = array(
    '#type' => 'textfield',
    '#title' => t('test'),
  );

  $form['field_student_age2'] = array(
    '#type' => 'textfield',
    '#title' => t('test2'),
  );

Then I stored them using the first method in the post quoted above.

$ewrapper->field_student_age[] = $form_state['values']['field_student_age'];
$ewrapper->field_student_age[] = $form_state['values']['field_student_age2'];

Rather than using set as I'd done with single values, I created a new entry for each value using [] =.

grammer
Source Link
Dominic Woodman
  • 2.2k
  • 4
  • 36
  • 60

I got the solution from Save a new value with entity_metadata_wrapper to an entity field which is an array.

I created two separate form fields.

function createnode_form($form, &$form_state){ 
  $form['field_student_age'] = array(
    '#type' => 'textfield',
    '#title' => t('test'),
  );

  $form['field_student_age2'] = array(
    '#type' => 'textfield',
    '#title' => t('test2'),
  );

Then I stored them using the first method in the post quoted above.

$ewrapper->field_student_age[] = $form_state['values']['field_student_age'];
$ewrapper->field_student_age[] = $form_state['values']['field_student_age2'];

Rather than using set as I'veI'd done with single values, I created a new entry for each value using [] =.

I got the solution from Save a new value with entity_metadata_wrapper to an entity field which is an array.

I created two separate form fields.

function createnode_form($form, &$form_state){ 
  $form['field_student_age'] = array(
    '#type' => 'textfield',
    '#title' => t('test'),
  );

  $form['field_student_age2'] = array(
    '#type' => 'textfield',
    '#title' => t('test2'),
  );

Then I stored them using the first method in the post quoted above.

$ewrapper->field_student_age[] = $form_state['values']['field_student_age'];
$ewrapper->field_student_age[] = $form_state['values']['field_student_age2'];

Rather than using set as I've done with single values, I created a new entry for each value using [] =.

I got the solution from Save a new value with entity_metadata_wrapper to an entity field which is an array.

I created two separate form fields.

function createnode_form($form, &$form_state){ 
  $form['field_student_age'] = array(
    '#type' => 'textfield',
    '#title' => t('test'),
  );

  $form['field_student_age2'] = array(
    '#type' => 'textfield',
    '#title' => t('test2'),
  );

Then I stored them using the first method in the post quoted above.

$ewrapper->field_student_age[] = $form_state['values']['field_student_age'];
$ewrapper->field_student_age[] = $form_state['values']['field_student_age2'];

Rather than using set as I'd done with single values, I created a new entry for each value using [] =.

improved formatting and punctuation
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

Ok so I was quite close. i got the solution from this postSave a new value with entity_metadata_wrapper to an entity field which is an array:

Solution.

I created two separate form fields:.

function createnode_form($form, &$form_state){ 
 
    $form['field_student_age'] = array(
      '#type' => 'textfield',
      '#title' => t('test'),
    );

    $form['field_student_age2'] = array(
      '#type' => 'textfield',
      '#title' => t('test2'),
    );

Then I stored them using the first method in the post quoted above:.

$ewrapper->field_student_age[] = $form_state['values']['field_student_age'];
$ewrapper->field_student_age[] = $form_state['values']['field_student_age2'];

Rather than using set as I've done with single values, I created a new entry for each value using [] =.

Ok so I was quite close. i got the solution from this post:

Solution

I created two separate form fields:

function createnode_form($form, &$form_state){ 
 
    $form['field_student_age'] = array(
      '#type' => 'textfield',
      '#title' => t('test'),
    );

    $form['field_student_age2'] = array(
      '#type' => 'textfield',
      '#title' => t('test2'),
    );

Then I stored them using the first method in the post quoted above:

$ewrapper->field_student_age[] = $form_state['values']['field_student_age'];
$ewrapper->field_student_age[] = $form_state['values']['field_student_age2'];

Rather than using set as I've done with single values I created a new entry for each value using [] =

I got the solution from Save a new value with entity_metadata_wrapper to an entity field which is an array.

I created two separate form fields.

function createnode_form($form, &$form_state){ 
  $form['field_student_age'] = array(
    '#type' => 'textfield',
    '#title' => t('test'),
  );

  $form['field_student_age2'] = array(
    '#type' => 'textfield',
    '#title' => t('test2'),
  );

Then I stored them using the first method in the post quoted above.

$ewrapper->field_student_age[] = $form_state['values']['field_student_age'];
$ewrapper->field_student_age[] = $form_state['values']['field_student_age2'];

Rather than using set as I've done with single values, I created a new entry for each value using [] =.

Source Link
Dominic Woodman
  • 2.2k
  • 4
  • 36
  • 60
Loading