In my node add form I have added one text area :
function mymodule_form_alter(&$form, $form_state, $form_id) {
if ($form_id == "contenttype_node_form") {
if (!isset($node->nid) || isset($node->is_new)) {
$form['extra']['#title'] = t('Title (Extra)');
$form['extra']['#type'] = 'textarea';
$form['extra']['#required'] = TRUE;
$form['extra']['#cols'] = '15';
$form['extra']['#resizable'] = FALSE;
$form['extra']['#rows'] = '5';
$form['#submit'][] = 'my_trans_submit';
}
}
}
function my_trans_submit(&$form, &$form_state){
$swed_title = $form['extra']['#value'];
}
Above code display one textarea just after title field in my node form. I Need the value entered in this text-area when user click on save node and then I want to use that value and save translation by running node save function. I can get this on form submit, but at that time node is not created and nid is not available.
How can I get value entered by the users in the above textarea once the node is saved and the node ID will be available, allowing me to use node_save()
? Do I have to use a form field? I was not using a form field as it creates a new entity table.
$node->field_title['fr'][0]['value'] = $from['extra']['value'];
but all other things are also required like nid etc so just need that value after node get saved.$form_state['values']
, not from$form
.