Skip to main content
olalekana0448
Inspiring
May 31, 2021
Question

Checkbox inside Hamburger Button

Is it possible to fold options in checkboxField inside Hamburger like button (to have the behavior of dropdown) in Appian?

    2 replies

    csteward
    Brainy
    June 2, 2021

    You can combine a!richTextDisplayField() and a!checkboxField() to achieve a similar result, where the checkboxes show under the buttons when clicked.  It would require a re-click on the buttons to hide the checkboxes however, vs a javascript type setup where they auto-collapse by clicking elsewhere randomly on the form, or as popups that do not expand the form.

    Some sample code:

    a!localVariables(
      local!options: {"Option 1","Option 2","Option 3"},
      local!data: {
        {visible: false, selected: null},
        {visible: false, selected: null},
        {visible: false, selected: null}
      },
      
      a!forEach(
        items: local!data,
        expression: {
          a!richTextDisplayField(
            labelPosition: "COLLAPSED",
            value: {
              a!richTextIcon(
                icon: "ellipsis-v",
                link: a!dynamicLink(
                  saveInto: a!save(local!data[fv!index].visible,not(fv!item.visible))
                )
              )
            }
          ),
          a!checkboxField(
            labelPosition: "COLLAPSED",
            showWhen: fv!item.visible,
            choiceLabels: local!options,
            choiceValues: local!options,
            value: if(
              rule!APN_isEmpty(fv!item.selected),
              null,
              split(fv!item.selected,";")
            ),
            saveInto: a!save(local!data[fv!index].selected,joinarray(save!value,";"))
          )
        }
      )
    )

    olalekana0448
    Inspiring
    June 4, 2021

    Thanks a lot, Chris. I will try to implement your suggestions and get back to you. Thank you once again