Skip to content

Conversation

@groupmsl
Copy link

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 added 6 commits April 1, 2021 12:35
(&, <, >, ") for default types (not date related, file, checkbox or range)
…n a rendered form if schema specifies default="true" even when source xml (from generated from XML, not just schema) specifies false
…cify default or fixed value. (Previously this was only the case if use="optional" was specified)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant