- last update
10 months ago 2,167 pass
HTML5 offers a "required" form element attribute for browser-native client-side validation.
Using the #required Form API attribute, add either of the following to an element:
TRUE: required="required" aria-required="true"
FALSE: [nothing]
For buttons that shouldn't require validation (like a 'Previous' button on a multi-paged form), a 'formnovalidate' attribute can be added to its #attributes property, which would output like this:
TRUE: formnovalidate="formnovalidate"
FALSE: [nothing]
Commit the patch from #1174938-93: Natively support the HTML5 required and aria-required FAPI properties → (attached)
HTML5 browsers will validate form elements that are marked as required, giving the user feedback on empty fields as they submit the form.
This patch adds the following options to the Form API:
$form['myelement']['#attributes']['required'] = TRUE;
$form['mysubmitbutton']['#attributes']['formnovalidate'] = TRUE;
Currently adding a #required => TRUE to a form element gives it a class, but now with HTML5 we can put the 'required' as a direct attribute in the form element itself.
http://diveintohtml5.info/forms.html#required
--
We're going to need a follow up issues for a required/toolbar bug.
Needs review
7.0 ⚰️
Last updated
It affects the ability of people with disabilities or special needs (such as blindness or color-blindness) to use Drupal.
It restores functionality that was present in earlier versions.
Used to alert the accessibility topic maintainer(s) that an issue significantly affects (or has the potential to affect) the accessibility of Drupal, and their signoff is needed (see the governance policy draft for more information). Useful links: Drupal's accessibility standards, the Drupal Core accessibility gate.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.