Skip to content

Checkbox is not rendered as expected #1

Description

@mg-cd-26

Checkbox is not rendered as expected

On the left you can see jsonforms sample and on the right a sample using go-jsonforms
Image

Given a testcase with this data.json, schema.json and uischema.json

// data.json
{
    "IsInputCheckbox": true,
    "IsInputText": false
}
// schema.json
{
  "type": "object",
  "properties": {
    "IsInputCheckbox": {
      "type": "bool",
      "description": "Boolean description as a tooltip"
    },
    "IsInputText": {
      "type": "boolean",
      "description": "Boolean description as a tooltip"
    }
  }
}
// uischema.json
{
  "type": "VerticalLayout",
  "elements": [
    {
      "type": "Control",
      "scope": "#/properties/IsInputCheckbox"
    },
    {
      "type": "Control",
      "scope": "#/properties/IsInputText"
    }
  ]
}

Then this html is created

<fieldset>
<div>
    <div class="form-group column col-12">
        <label class="form-checkbox form-inline" id="#/properties/IsInputCheckbox" name="#/properties/IsInputCheckbox">
            <input type="checkbox"><i class="form-icon"></i>
        </label>
    </div>
    <div class="form-group column col-12">
        <input class="form-input" id="#/properties/IsInputText" name="#/properties/IsInputText" type="boolean" aria-describedby="#/properties/IsInputText-helper">
        <small id="-helper">Boolean description as a tooltip</small>
    </div>
</div>
</fieldset>

GOT

  • The property IsInputCheckbox with type bool is rendered as a checkbox and lacks a label
  • The property IsInputText with type boolean is rendered as a input type text. It lacks a label. The description is displayed as helper text below the node.

WANT

The labels documentation states this

Labels are determined by JSON Forms in the following way:

  • If an UI Schema label is set, it will be used as the label
  • If there is no UI Schema label but a JSON Schema title, the JSON Schema title will be used as the label
  • If there is no UI schema label and no JSON Schema title, the label will be derived from the property name

Thanks
Best regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions