Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By alisamar on
I just want to call a function If the form is submitted correctly... Is there such a method?
Comments
Yes. For each form you
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
This is partly correct!
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!