brutusin / json-forms

JSON Schema to HTML form generator, supporting dynamic subschemas (on the fly resolution). Extensible and customizable library with zero dependencies. Bootstrap add-ons provided
http://brutusin.org/json-forms
Apache License 2.0
606 stars 168 forks source link

Issue#37: add support for radio button #149

Closed saicheck2233 closed 1 year ago

saicheck2233 commented 1 year ago

Issue#37: Support for radio button inputs

Link: Issue#37

Description: Add support for radio button inputs, below is the schema used for generating a radio button. format:radio and enum is needed for generating radio buttons.

{
    "$schema": "http://json-schema.org/draft-03/schema#",
    "type": "object",
    "properties": {
        "pageSize": {
            "type": "boolean",
            "format": "radio",
            "title": "Page size",
            "description": "Number of records per page",
            "enum": [
                10,
                25,
                50,
                100
            ]
        }
    }
}

Pic before changes: image Before having radio button support, it falls back to dropdown selection.

Pic after changes: image After radio button format is implemented, now it is showing radio button.