Skip to content
TheChatArchiveThe Chat Archive
Coherecommand-a-03-2025· CohereHugging Face LMArena Human Preference 140K

how to make a check box in kobo that when selected will render an input field

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with o3-mini’s answer.
  1. User

    how to make a check box in kobo that when selected will render an input field

  2. Cohere Assistant

    To create a checkbox in KoboToolbox (or KoboCollect) that, when selected, renders an input field, you can use Relevant Logic in your form design. This feature allows you to show or hide questions based on the user's input. Here's how to do it:


    Steps to Create a Checkbox-Triggered Input Field

    1. Open KoboToolbox Form Builder:

      • Log in to your KoboToolbox account and open the form builder for the form you want to edit.
    2. Add a Checkbox Question:

      • Add a Select One or Select Multiple question type for the checkbox.
      • For simplicity, use Select One with options like Yes and No.

      Example:

      <select1 name="trigger_checkbox" label="Do you want to provide additional details?">
        <item name="yes" label="Yes"/>
        <item name="no" label="No"/>
      </select1>
      
    3. Add an Input Field:

      • Add a text input field (or any other input type) that you want to show when the checkbox is selected.

      Example:

      <text name="additional_details" label="Additional Details"/>
      
    4. Apply Relevant Logic:

      • Use the relevant attribute to control when the input field should appear.
      • Set the input field to be relevant only when the checkbox is selected (yes).

      Example:

      <text name="additional_details" label="Additional Details" relevant="${trigger_checkbox} = 'yes'">
      
    5. Complete XML Structure: Here’s the complete XML structure for the form:

      <h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jr="http://openrosa.org/javarosa">
        <h:head>
          <h:title>Checkbox Triggered Input Field</h:title>
          <model>
            <instance>
              <data id="checkbox-triggered-input">
                <trigger_checkbox/>
                <additional_details/>
              </data>
            </instance>
          </model>
        </h:head>
        <h:body>
          <select1 name="trigger_checkbox" label="Do you want to provide additional details?">
            <item name="yes" label="Yes"/>
            <item name="no" label="No"/>
          </select1>
          <text name="additional_details" label="Additional Details" relevant="${trigger_checkbox} = 'yes'"/>
        </h:body>
      </h:html>
      
    6. Save and Deploy:

      • Save the form and deploy it to test the functionality.

    Explanation

    • The relevant attribute uses XPath logic to determine when the input field should be displayed.
    • ${trigger_checkbox} = 'yes' checks if the checkbox is set to "Yes" and shows the input field only if true.

    Alternative: Using KoboToolbox Form Builder UI

    If you prefer using the Form Builder UI instead of XML:

    1. Add a Select One question (for the checkbox).
    2. Add a Text question (for the input field).
    3. Click on the Text question, go to the Relevant field, and enter the condition:
      ${trigger_checkbox} = 'yes'
      
      (Replace trigger_checkbox with the actual name of your checkbox question.)

    This setup ensures the input field only appears when the checkbox is selected, providing a dynamic and user-friendly form experience.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.

Identical first prompt