Changing a form value or input field value during the submit handler I am trying to change the value of a text area field at the end of my submit handler. I have tried using form_set_value and $form['form_id']['#value'] = 'something'; to accomplish this but after clicking the submit button the field never changes. Also the submit button that I am trying to change the field with comes from the file managed form. I also included $form_state['rebuild'] = true; after I set the field's value. Here is my code

function my_module_my_form_submit($form,&amp;$form_state) {

//do something with then file code
...


then

$form_set_value($form['value_to_change'], 'update the value, $form_state);


//I also tried

$form['value_to_change']['#value'] = 'update the value';

$form_state['rebuild'] =TRUE
}


In the form my code is

$form['value_to_change'] = array(
'#type' = 'text area',
'#value' =&gt; 'this will change',
);
Just stumbled upon this and it's pretty dead so here's the answer in case OP still cares... turns out @Mołot is right.

The correct way to programatically change a form's submitted value is actually during validation and not during submission.

If you go back and re-read the documentation for form_set_value(), you'll notice that it explicitly says:


  Changes submitted form values during form validation.