Skip to main content
Bounty Ended with 50 reputation awarded by Gokul N K
Adding some extra info.
Source Link
rooby
  • 14.7k
  • 1
  • 40
  • 82

The main problem is you are not passing the form array by reference so your values are never coming back into the form. Try this (note the ampersand on $form['submitted']):

function my_module_form_alter(&$form, &$form_state, $form_id) {
  $submitted = &$form['submitted'];
  prepopulate_form($submitted, $value_array);
}

Otherwise you are only modifying the $submitted variable and not the actual form.

Alternatively, you could also just pass $form['submitted'] into the prepopulate_form() function instead of using the $submitted variable and that would also work.

Plus, you are using $value_array, which does not exist, so you will need to pass actual values in.

The main problem is you are not passing the form array by reference so your values are never coming back into the form. Try this (note the ampersand on $form['submitted']):

function my_module_form_alter(&$form, &$form_state, $form_id) {
  $submitted = &$form['submitted'];
  prepopulate_form($submitted, $value_array);
}

Plus, you are using $value_array, which does not exist, so you will need to pass actual values in.

The main problem is you are not passing the form array by reference so your values are never coming back into the form. Try this (note the ampersand on $form['submitted']):

function my_module_form_alter(&$form, &$form_state, $form_id) {
  $submitted = &$form['submitted'];
  prepopulate_form($submitted, $value_array);
}

Otherwise you are only modifying the $submitted variable and not the actual form.

Alternatively, you could also just pass $form['submitted'] into the prepopulate_form() function instead of using the $submitted variable and that would also work.

Plus, you are using $value_array, which does not exist, so you will need to pass actual values in.

Source Link
rooby
  • 14.7k
  • 1
  • 40
  • 82

The main problem is you are not passing the form array by reference so your values are never coming back into the form. Try this (note the ampersand on $form['submitted']):

function my_module_form_alter(&$form, &$form_state, $form_id) {
  $submitted = &$form['submitted'];
  prepopulate_form($submitted, $value_array);
}

Plus, you are using $value_array, which does not exist, so you will need to pass actual values in.