I added a custom button to my form which I want to call a function which grabs some values from that form, email them out to whomever, and then save the form. I have successfully emailing the value, but I cannot get the form to save.
function my_mod_form_node_form_alter(&$form, &$form_state, $form_id) {
$type = $form['type']['#value'];
if($type !== 'support_ticket')
return;
$form['actions']['submit2'] = array(
'#type' => 'submit',
'#value' => t('Accept And Close'),
'#submit'=>array('my_mod_email_and_close')
);
return $form;
}
function my_mod_email_and_close(&$form, &$form_state)
does not contain any logic to actually save the form values. It only checks the form for some values and emails those values out.
I need to save the form however, how do I also get this custom button to submit and save the form. I tried adding these lines to the bottom of my_mod_email_and_close()
$form_id = $form['form_id']['#value'];
drupal_form_submit($form_id, $form_state);
but it doesn't actually save. I get 2 of the same errrors however: Trying to get property of non-object in _support_assigned()
from a different module so I am not sure whats going on.
Perhaps I am using the wrong hook?