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.
This issue occurs when using a custom form element of type 'tableselect', with the multiple option set to false (to provide radio buttons instead of checkboxes). If the form fails validation then the option selected by the client within the tableselect is forgotten when the form is re-rendered.
If the form is submitted successfully then the value submitted by the user is correctly sent through to the submit handler - which is good.
The problem does not occur when the tableselect is in the multiple mode (i.e. checkboxes).
Comment | File | Size | Author |
---|---|---|---|
#1 | tableselect-validation-error:q-1662602-1.patch | 642 bytes | mdixoncm |
Comments
Comment #1
mdixoncm CreditAttribution: mdixoncm commentedWe have traced this down to form_process_tableselect - which has different logic when dealing with multiple or non multiple versions of the tableselect. The non multiple version is NOT utilising the $element['#value'] at any point - it is always using the original default_value from the element,
The following patch will make use of the $element['#value'].