- ๐ฎ๐ณIndia AditiVB
Aditi Saraf โ made their first commit to this issueโs fork.
- ๐ฉ๐ชGermany michaellenahan
Removed novice tag because not a straightforward drupal 11 fix.
If you have any kind of form element without a title and it's required you will not see that it's actually required on form validation.
The problem is, that form_get_error() returns an empty string which is implicitly casted to boolean in the following statement:
if (isset($element['#parents']) && form_get_error($element))
In _form_set_class(), check for !== NULL.
This is no longer an issue in D8.
<!-- See https://drupal.org/core-mentoring/novice-tasks for tips on identifying novice tasks. Delete or add "Novice" from the Novice? column in the table below as appropriate. Uncomment tasks as the issue advances. Update the Complete? column to indicate when they are done, and maybe reference the comment number where they were done. -->n/a
n/a
If you have any kind of form element without a title and it's required for example you will not see that it's actually required.
The problem is that #required uses
if (isset($elements['#title'])) {
form_error($elements, $t('!name field is required.', array('!name' => $elements['#title'])));
}
else {
form_error($elements);
}
So form_error set's a error = '';
Now in _form_set_class
if (isset($element['#parents']) && form_get_error($element)) {
$element['#attributes']['class'][] = 'error';
}
But '' is a boolean false so there is no error message.
Needs work
9.5
Last updated
Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.
After being applied to the 8.x branch, it should be considered for backport to the 7.x branch. Note: This tag should generally remain even after the backport has been written, approved, and committed.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Aditi Saraf โ made their first commit to this issueโs fork.
Removed novice tag because not a straightforward drupal 11 fix.