# Supported Question Types

This page outlines the various input question types used in the application, and examples and guidelines for implementation.

# Understanding inputType

The inputType property is a key aspect of the JSON object that represents a field of the form on a third-party website we mined. It serves two main purposes:

  1. Field Representation: It indicates the type of input field that should be rendered on the frontend. For example, a question with "inputType": "SelectOne" suggests that a dropdown menu should be used.

  2. Value Expectations: It dictates the type of value that the API expects as an answer to the question. For instance, a SelectOne input type expects a string value corresponding to the selected option.

# Examples of inputType Implementations

  • Text:

    • JSON: { "inputType": "Text" }
    • Frontend Implementation:
      <input type="text" />
      
    • Expected Value: String
  • TextArea:

    • JSON: { "inputType": "TextArea" }
    • Frontend Implementation:
      <textarea></textarea>
      
    • Expected Value: String
  • SelectOne:

    • JSON: { "inputType": "SelectOne", "options": [{ "answer": "Yes" }, { "answer": "No" }] }
    • Frontend Implementation:
      <select>
        <option value="Yes">Yes</option>
        <option value="No">No</option>
      </select>
      
    • Expected Value: String (e.g., "Yes" or "No")
  • SelectMultiple:

    • JSON: { "inputType": "SelectMultiple", "options": [{ "answer": "Option 1" }, { "answer": "Option 2" }] }
    • Frontend Implementation:
      <input type="checkbox" value="Option 1"> Option 1<br>
      <input type="checkbox" value="Option 2"> Option 2<br>
      
    • Expected Value: Array of Strings (e.g., ["Option 1", "Option 2"])
  • Boolean:

    • JSON: { "inputType": "Boolean" }
    • Frontend Implementation:
      <input type="radio" name="boolean" value="true"> Yes<br>
      <input type="radio" name="boolean" value="false"> No<br>
      
    • Expected Value: Boolean (e.g., true or false)
  • File:

    • JSON: { "inputType": "File" }
    • Frontend Implementation:
      <input type="file" />
      
    • Expected Value: File object

# Input Types

Input Type Description
Text A text input field.
TextArea A multiple-line text input field.
TextLiteral Static text often used for informational purposes, formatted with HTML where necessary.
SelectOne Single-choice dropdown or radio button selection, with available answers in options and possible follow-up questions in conditionalQuestions.
SelectMultiple Multiple-choice selection, storing choices in options with any dependent questions in conditionalQuestions.
Date A date input field.
Boolean A boolean input field.
File A file upload field.
ArrayOfObjects An array of arrays of objects relating to repeatable questions on the job post, e.g., a list of previous experience, each with repeatable questions. Example: "Please list your previous job experiences, including job title, company, and duration."
FragmentedQuestion An array of objects relating to a single set of answers. Example: "What is your availability for the next month? Please specify days and times."

# Conditional Questions

Conditional questions are those that depend on the answer to a previous question. For example, if a user selects "Yes" to a question, a follow-up question may appear asking for more details.

Example of a Conditional Question:

{
  "question": "Do you have any previous work experience?",
  "id": "previous-work-experience",
  "inputType": "SelectOne",
  "options": [
    {
      "answer": "Yes",
      "conditionalQuestions": [
        {
          "question": "Please describe your previous work experience.",
          "id": "work-experience-description",
          "inputType": "Text",
          "mandatory": true
        }
      ]
    },
    {
      "answer": "No",
      "conditionalQuestions": []
    }
  ],
  "label": "Work Experience",
  "mandatory": true
}

# Example Apply Request

The expected format for answers is an array of objects, where each object contains an id and a value formatted according to the question's inputType.

[
  { "id": "do-you-have-right-to-work-in-the-uk", "value": "Yes" },
  { "id": "are-you-resident-in-the-uk", "value": "No" }
]

# Handling Special Cases

  • Optional questions: If a question is marked as "mandatory": false, it can be omitted from the /apply payload.
  • Validation rules: Ensure correct data types for answers.
  • Date & number formats: Follow ISO-8601 for dates (YYYY-MM-DD) and plain numbers for salary expectations.