- π©πͺGermany Anybody Porta Westfalica
Just ran into this, when implementing 3.0x of the Homebox module. This is still an issue.
At the moment when you execute an ajax call and haven't set #validate
the form validation will be executed, for that to happen the entity will be built first based on the current user input. This means each time you add an item to a multiple field the entity will be built and validated. In WidgetBase we set #limit_validation_errors
so the form array will not be completely validated, but only the field part of it, for which a new item has been added.
Lets say you add 10 items per ajax and submit the form, what happens is that the entity is built and validated not just once but 10+1 times for each "item add" and for the final form submission, which is unnecessary and on big forms might have a performance impact.
Make it possible to turn off form validation on ajax calls. At the moment to skip the form validation you need to simply set #validate
and in this case only the validation handlers set in #validate
will be executed, otherwise the form #validate
will be used. However atm we cannot set #validate
as an empty array. For this to work we have to make couple of adjustments in the FormValidator and in FormState, so that if #validate
is set and even as an empty array then use the validation handlers from it.
Additionally set '#validate' => []
on the add_more submit
in WidgetBase.
Review.
None.
Setting '#validate'
even as an empty array will turn the form validation for ajax calls.
None.
Needs work
11.0 π₯
Last updated
It affects performance. It is often combined with the Needs profiling tag.
Used to track the progress of issues reviewed by the Drupal Needs Review Queue Initiative.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Just ran into this, when implementing 3.0x of the Homebox module. This is still an issue.