xsd2html2xml icon indicating copy to clipboard operation
xsd2html2xml copied to clipboard

Enumerations empty by default

Open groupmsl opened this issue 9 months ago • 0 comments

Furthering the fix to #23, an empty value is added to an HTML select element when there is no default or fixed value specified.

This doesn't alter the existing behaviour that attributes with @use="optional" provides an default, empty value

If there is no @use, @default or @fixed attributes a default, empty value is provided (this is a change)

If @use="required" is specified a default, empty value is still provided, so that the user has to make an informed choice, rather than the first item in the list being pre-selected and possibly submitted without even thinking about it. If the user tries to submit the form without chosing a valid (non-empty) selection then the HTML validation will complain.

If @default or @fixed is provided, no empty value will be provided. I think this is definitely correct for @fixed, but @default could be argued that we should allow an empty value, but it shouldn't be the default. I did test this, but it is not what I am submitting because in my case my XML processor (that handles the submitted form) adds omitted attributes with their default value anyway. I don't mind adding this (a blank option when @default is set) if you think it is incorrect though.

groupmsl avatar Mar 27 '25 11:03 groupmsl