Reputation: 1036
I am working on a module which is common for a number of forms. I need to pass the $form_id as a parameter to the submit handler and set the form values accordingly in the submit function.
function ppi_form_alter(&$form, &$form_state, $form_id){
$form['#submit'][]="action_form_submit";
}
function action_form_submit($form, &$form_state) {
//here I need to get the form_id of the form and form_set_value accordingly ... How can I know the form value?
}
Is there a way to know the form_id in form_submit ?
Thanks!
Upvotes: 2
Views: 2100
Reputation: 46
Set it as a hidden field in the hook_form_alter(), and then use it as you would any other field in the submit handler
Upvotes: 2