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.
Hi,
The form input type number is wrong to the HTML5 W3C validation (http://validator.w3.org/nu).
I fixe this with a modification in the module:
I disable this in the file "components/number.inc":
line 292 - 294
if ($element['#max']) {
$element['#size'] = strlen($element['#max']) + 1;
}
And i changed this:
Line 238
foreach (array('id', 'name', 'value', 'size', 'min', 'max', 'step') as $property) {
by that:
foreach (array('id', 'name', 'value', 'min', 'max', 'step') as $property) {
And the HTML5 W3C validation work fine.
excuse me for my english, but i'm french.
Thanx !
Comments
Comment #1
Bessonweb CreditAttribution: Bessonweb commentedHi,
it's the same problem with input file type
Error: Attribute size not allowed on element input at this point.
I search the solution but i find this in "components/file.inc" :
But the attribute "size" is always here. Why ?
Edit: I changed the drupal core module file in "modules/file/file.module" and it's ok.
Line 75:
The HTML5 W3C validation is now correct.
Comment #2
quicksketchThis is true, but "size" is supported by browsers that don't support HTML5 number inputs. So it's used as the fallback when a browser doesn't support number inputs.
Unfortuantely, even though "size" is not part of the HTML 4 or XHTML 1.1 spec, it's respected by browsers: http://stackoverflow.com/questions/572768/styling-an-input-type-file-button
I'm not sure if size has been added to the HTML5 spec, but since we work in the real world, an intentional setting of size is better than following a spec.
So for now, both of these issues are intentional. Setting size on both of these elements has an effect (either for backwards compatibility or for visual display).