I just want to call a function If the form is submitted correctly... Is there such a method?

Comments

jaypan’s picture

Yes. For each form you create, you can define a _validate() and _submit() function. If no errors are found in the _validate() function, then the _submit() function is called.

http://api.drupal.org/api/drupal/includes!form.inc/group/form_api/7

Contact me to contract me for D7 -> D10/11 migrations.

mortenthorpe’s picture

You don't specify any single submit-function to call upon form submit-action. You add a submit-function name to the list of called submit-functions for that form, and this will be correct. See also the form API reference, #submit, for more on this!