Ajax form validating
Last updated on
24 April 2025
Drupal has a wonderful form processing subsystem, especially in 5.x.
Now, hook_validate only gets invoked after pressing the submit button. But the form items which are rejected by hook_validate, such as required fields, don't provide good visual feedback to the user. There are a lot of average users asking why the form remains the same after pressing submit.
If validation could be done via Ajax, the fields which have errors (set by form_set_error) should give better visual feedback to the user which is easily noticed.
ATM, Ajax form validating should be compatible with 5.x, which means no more API changes.
Help improve this page
Page status: Not set
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion