Skip to content

Mutually Exclusive Checkboxes

SamGodwin2 edited this page Aug 23, 2018 · 2 revisions

This page is a basic outline for the implementation of mutually exclusive checkboxes.

Graphql Schema

input CreateMutuallyExclusiveOptionInput {
  label: String
  description: String
  value: String
  qCode: String
  answerId: ID!
}

type MultipleChoiceAnswer implements Answer {
  id: ID!
  description: String
  guidance: String
  qCode: String
  label: String
  type: AnswerType!
  mandatory: Boolean @deprecated(reason: "Use \`properties\` instead.")
  options: [Option]
  other: OptionWithAnswer
  mutuallyExclusiveOption: Option
  page: QuestionPage
  properties: JSON
}

Database Structure

Option Table

id AnswerId isDeleted isExculsive
1 1 1 true

Runner Format.

In order for runner to display the MU checkbox with the correct settings, the following schema pattern must be used:

  "answers": [{
    "id": "mandatory-checkbox-answer",
    "mandatory": true,
    "options": [{
            "label": "Cheese",
            "value": "Cheese",
            "q_code": "1"
        },
        {
            "label": "Ham",
            "value": "Ham",
            "q_code": "2"
        },
        {
            "label": "Pineapple",
            "value": "Pineapple",
            "q_code": "3"
        },
        {
            "label": "Tuna",
            "value": "Tuna",
            "q_code": "4"
        },
        {
            "label": "Pepperoni",
            "value": "Pepperoni",
            "q_code": "5"
        },
        {
            "label": "No extra toppings",
            "value": "No extra",
            "q_code": "7"
        }

     ],
    "type": "MutuallyExclusiveCheckbox"
}]
Clone this wiki locally