Reputation: 270
I'm trying to modify the file description field inside the form_alter
function by using the form_submit
function.
In my hook_FORM_ID_alter()
function I'm assigning a new data array as:
function hook_FORM_ID_alter(&$form, &$form_state) {
$field['data']['description'] = 'some value';
$form['field_upload']['und'][0]['#default_value'] = $field;
}
Then in my hook_form_submit()
function, I'm trying to pass the value into another function at the same time store it inside my field_upload_description
field
function hook_form_submit($form, &$form_state) {
$values = $form_state['values'];
$doc = $values['data']['description'];
$result = some_other_function($doc);
}
Nothing happens. As a matter of fact, when I go back to edit the node, the file is no longer attached in the file field.
I'm not sure what I'm missing.
Upvotes: 0
Views: 9282
Reputation: 169
You did a mistake in the declaration of the hook function, so your first function is probably not called !!
/**
* Implements hook_form_FORM_ID_alter() for FORM_ID().
*/
function hook_form_YOUR-FORM-ID_alter(&$form, &$form_state, $form_id) {
}
Upvotes: 1