I’m modyfing a node form to add a few extra fields. On submit, I need to program some extra logic to these values then save them to the node object.
function module_form_alter(&$form, &$form_state, $form_id) { if($form_id == 'my_node_form') { $form['custom_form'] = array( '#type' => 'textfield', '#title' => t('Custom field'), '#default_value' => 'enter custom text here', ); $form['#validate'][] = 'custom_form_process_values'; } } function custom_form_process_values(&$form, &$form_state, $form_id) { echo '<pre>' . print_r($form_id,1) . '</pre>'; echo '<pre>' . print_r($form_state,1) . '</pre>'; exit(); }
When I go to node/22/edit and change "enter custom text here" to something else, and I submit the form, I only ever see "enter custom text here" and not the new text I entered. It seems that it does not carry the text through to the validate function. Also tried it in a submit function but the same problem occurs.
Why does this happen?