JsonSchema-JavaUI / sf-java-ui

Json Schema Form java based library allow developers to define schema and form using field annotations
MIT License
24 stars 16 forks source link

Clarification Needed: Simple Boolean Field (using Tabs) #81

Open lbispham opened 6 years ago

lbispham commented 6 years ago

Description

I would like a simple boolean field (a single checkbox) for a field called "Enabled".

booleancheckbox

In Angular Schema Form, I can accomplish this with the following:

boolean

I don't want to use the Checkboxes or RadioBox components here because in this case they are overkill

toomuch

I just want to have my boolean field appear in the form.

DisplayAllFields doesn't appear to be released yet but even if it were, it seems to have no effect on tabs (which I need to use). I forked the code and ran the TabbedFormTest unit test. I removed the @TextField annotation from the lastName field but added @DisplayAllFields to the form.

displayallfieldstabs

I ended up with the following output:

{
    "schema": {
    "type": "object",
    "id": "urn:jsonschema:io:asfjava:ui:core:schema:TabbedForm"
  },
  "form": [
    {
      "type": "tabs",
      "tabs": [
        {
          "title": "Info",
          "items": [
            {
              "key": "firstName",
              "description": "This is a description for your first name field",
              "placeholder": "Your first name"
            },
            null
          ]
        },
        {
          "title": "Contact",
          "items": [
            {
              "key": "email",
              "description": "This is Text Field with pattern and validation message",
              "placeholder": "Your email",
              "validationMessage": "Your mail must be in this format jhondoe@example.com"
            }
          ]
        }
      ]
    },
   {
      "key": "webSite",
      "description": "This is TextField with fieldAddonLeft",
      "fieldAddonLeft": "http:\/\/"
    }
  ]
}

Expected behavior: [What you expect to happen]

I think what I'm looking for is an annotation for a single field something like "DisplayInForm" that will place the field into the form (or into the tabs). Kind of like a singular version of DisplayAllFields (that will work with tabs). Is there another way to do this that I've missed?

Thanks!

Versions

1.0.1

Additional Information

Any additional information, configuration or data that might be necessary to reproduce the issue.