You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The docs seem to concentrate on using enum and json-schema non-compliant enumNames for creating radio, select or checkboxes. A compliant way seems to be to use oneOf (anyOf) and const
Would be great if there were some examples for this like the following:
Using something like this can be preferred as it as a clear value attribute whereas the enums alone can result in special characters in the value in the html.
Same for checkboxes where an example like the following would be great:
selectboxesExample: {type: "array",title: "Select boxes, that is multiple checkboxes",items: {type: "string",enum: ["A Checkbox1","A Checkbox2","A Checkbox3","A Checkbox4"]},uniqueItems: true}
These should be in the docs somewhere I could only find these in the PR at #581 Especially, with const I find the schema very readable and clear.
PS
what I find strange is that there's no working example for using oneOf (or anyOf) using a select dropdown. This renders as number, but maybe I am doing it wrong:
"selectExample": {"title": "Should render a Select Dropdown but renders a Number widget","type": "array","uniqueItems": true,"items": {"type": "number",// could also be "oneOf":"anyOf": [{"const": 1,"title": "One"},{"const": 2,"title": "2"},{"const": 3,"title": "Three"}]}},
EDIT: Forget the PS part. It works with (although, which should also be added to the docs):
"selectExample": {"title": "a select with const","type": "number","oneOf": [{"const": 1,"title": "One"},{"const": 2,"title": "2"},{"const": 3,"title": "Three"}]},
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please leave a comment if this is still an issue for you. Thank you.
Prerequisites
Description
The docs seem to concentrate on using
enum
and json-schema non-compliantenumNames
for creating radio, select or checkboxes. A compliant way seems to be to useoneOf
(anyOf
) andconst
Would be great if there were some examples for this like the following:
and
Using something like this can be preferred as it as a clear
value
attribute whereas theenum
s alone can result in special characters in thevalue
in the html.Same for checkboxes where an example like the following would be great:
at the moment there's only this as example
These should be in the docs somewhere I could only find these in the PR at #581 Especially, with
const
I find the schema very readable and clear.PS
what I find strange is that there's no working example for using
oneOf
(oranyOf
) using a select dropdown. This renders as number, but maybe I am doing it wrong:EDIT: Forget the
PS
part. It works with (although, which should also be added to the docs):The text was updated successfully, but these errors were encountered: