Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

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,&$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' => 'this will change',
);
share|improve this question
Try $form_state['values']['YOURFIELD'] it should be working – Nikhil M Jun 4 at 2:01
Generally accepted place for changing form is validator, not submit handler. Is there any particular reason to do it on submit? – Mołot Jun 4 at 9:12

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.