By petar_basic on
Change record status:
Draft (View all draft change records)
Project:
Introduced in branch:
main
Introduced in version:
Issue links:
Description:
Form elements with an #ajax callback can now opt out of required-field validation during the AJAX submission, without disabling other validation. Previously the only option was #limit_validation_errors = [], which suppresses all validation, including custom validators.
$form['my_button']['#ajax'] = [ 'callback' => '::myCallback', 'suppress_required_fields_validation' => TRUE, ];
When set, required-field errors are skipped while the AJAX request rebuilds the form; all other validation still runs. The opt-in is read from the server-side form structure (the triggering element's #ajax settings), so it cannot be triggered by a crafted request. Required validation still applies on the final, non-AJAX form submission.
Impacts:
Module developers