Closed (duplicate)
Project:
Drupal core
Version:
7.x-dev
Component:
forms system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
17 Oct 2010 at 03:17 UTC
Updated:
28 Jun 2011 at 04:42 UTC
Splitted from #942310: Field form cannot be attached more than once.
Problem: form_builder() doesn't allows to alter #limit_validation_errors for $form_state['triggering_element'] on #after_build. I think this is not how it must be. We can't always know where exactly submit button is on the form or parents array to validate.
Attached patch fixes the issue.
| Comment | File | Size | Author |
|---|---|---|---|
| limit_validation_errors_after_build.patch | 1.09 KB | an.droid |
Comments
Comment #1
an.droid commentedSorry, there are two files because I caught a 503 error when posting this issue.
Comment #2
sun.core commentedThe stated problem is not a problem but a goal. Please state the problem.
Comment #3
effulgentsia commentedI'm also not clear on what the use-case problem is, but if we're unhappy that form_builder() does things after calling #after_build that modules are then unable to alter, how about if we move everything form_builder() does after calling #after_build into a #after_build callback of the 'file' and 'form' types?
Comment #4
an.droid commentedWell, the actual problem was in earlier work on patch for #942310: Field form cannot be attached more than once. Initially my suggestion was to use 'namespaces' to separate fields of different entities in
$form_state['field']. This approach requires me to set#limit_validation_errorsfor 'add_more' buttons on#after_buildwhen all parents are known. That's how I found this limitation.As of now we moved from 'namespace' approach to use
#parentsinstead, so the problem went away by itself.I agree this is an edge case, so maybe we should postpone it until we find critical use-case problem?
Comment #5
quicksketchSeems like #942310: Field form cannot be attached more than once fixed this one? Obviously there hasn't been any more action on this since that issue was fixed, my guess is it fixed this issue too. In any case, this is at best a normal issue.