0

How can I call a function using drupal_get_form when a submit button is clicked. My situation is that i have a custom module where there is only a submit button. So when that submit button is clicked I want to call a particular function. How can I achieve it through drupal_get_form.

2
$form['#submit'][] = 'myform_form_submit';

You can call your function as above. Or

function myform_form_submit($form, &$form_state) {
  //execute your function here
}
1
  • myform_form_submit will work if your form name is myform_form – niksmac Jul 20 '15 at 10:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.