formbuilder icon indicating copy to clipboard operation
formbuilder copied to clipboard

Add a flexible option

Open glasserc opened this issue 8 years ago • 3 comments

I would like to write a question like this:

What is your favorite kind of ice cream?

[ ] chocolate
[ ] vanilla
[ ] other (please specify) ____________

At present, the "option list" only lets you put in fixed values, so this isn't possible yet.

glasserc avatar Jun 22 '16 12:06 glasserc

I have no idea how I would describe this thing in a JSON schema. Any idea?

almet avatar Jun 22 '16 15:06 almet

I might be possible using an array with multiple types also what most form do is to add an other selection with a comment input after.

Natim avatar Jun 22 '16 15:06 Natim

It's not amazing, but how about:

{
  "type": "object",
  "title": "Untitled form",
  "description": "Enter some description for your form here",
  "properties": {
    "question_1": {
      "title": "Question 1",
      "oneOf": [
        {
          "type": "string",
          "enum": [
            "option 1",
            "option 2",
            "option 3"
          ]
        },
        {
          "type": "string",
          "title": "Other (please specify)"
        }
      ]
    }
  }
}

glasserc avatar Jun 24 '16 17:06 glasserc