Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCU-2042

Switchable Field: Clarify the references between the option-group and the form

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Won't Do
    • Neutral
    • None
    • None
    • None
    • None

    Description

      Situation:

      Problem:

      • Example code of the docu uses only foo and bar everywhere:
      switchable:
        $type: switchableField
        field:
          $type: radioButtonGroupField
          datasource:
            $type: optionListDatasource
            options:
              - name: foo
                value: foo
              - name: bar
                value: bar
        itemProvider:
          $type: jcrChildNodeProvider
        forms:
          - name: foo
            properties:
              foo:
                $type: textField
          - name: bar
            properties:
              bar:
                $type: richTextField
      
      • When adding real fields I stumbled over what in the 'options' references what in the 'forms'. Took me some time to figure it out.
      • It is not intuitive! My first guesses were all wrong!
        This code works/is the solution:
          switchable:
            $type: switchableField
            label: Test Switchable
            field:
              $type: radioButtonGroupField
              datasource:
                $type: optionListDatasource
                options:
                  - name: whatever1
                    value: foo
                    label: Foo
                  - name: whatever2
                    value: bar
                    label: Bar
            itemProvider:
              $type: jcrChildNodeProvider
            forms:
              - name: foo
                properties:
                  whatever3:
                    $type: textField
                    label: Foo
              - name: bar
                properties:
                  whatever4:
                    $type: richTextField
                    label: Bar
      
      • see the : whatever1-4 -> they are all ignored/not relevant!
      • So what references what:
        • the form's name references the options value!

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                akhamis Ashraf Khamis
                cringele Christian Ringele
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: