This is the source code of an address field from address field module. I'm not sure why there is a 0 in the size field (may be a bug), but should we fix such issues here?

Validation error:
line 248 column 131 - Error: Bad value 0 for attribute size on element select: Zero is not a positive integer.

Code example:

<select size="0" name="field_address[und][0][country]" id="edit-field-address-und-0-country" class="country form-select required ajax-processed">
<option value="AF">Afghanistan</option><option value="AX">Aland Islands</option>
<option value="AL">Albania</option>
<option value="DZ">Algeria</option>
<option value="AS">American Samoa</option>
<option value="AD">Andorra</option>


hass’s picture

Project:HTML5 Tools» Address Field
Category:feature» bug

Moving to Address Field as I have found that a value of 0 is invalid per API docs

Values: A positive number.


Specifies the number of options to show to the user. The value must be a valid non-negative integer greater than zero. If the multiple attribute is present, then the size attribute's default value is 4. If the multiple attribute is absent, then the size attribute's default value is 1.

goron’s picture

Status:Active» Needs review
new429 bytes

I encountered this too. It can be a problem when formatting select elements, for instance with formalize.css.

This patch fixes the issue. Just removed one line. I'm not sure why that line was there in the first place, doesn't seem like it's needed for anything.

goron’s picture

I see now that the line was there to "cancel" the #size property that may have been set before on the element. But it should be unset rather than zeroed. Here's a new patch.

hass’s picture

Great that you found the reason for this line. We should add a short comment about the reason.

rszrama’s picture

Issue summary:View changes
Status:Needs review» Fixed

Status:Fixed» Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.