Skip to main content
May 20, 2021
Question

Text field

  • May 20, 2021
  • 5 replies
  • 0 views

I have a requirement with one text field ,adjacent to the label of text field i need to have a check box of boolean type how can i acheive this?

Thanks..

    5 replies

    harshas2775
    Brainy
    May 20, 2021

    Its not possible to have the checkbox before the textfield itself, as described in your usecase. As a workaround you can add a label-less checkbox component below the textfield in the UI. For user's it can make do as related to the text field but from the backend code textField and checkboxField can be tied together. 

    kunals0003
    May 20, 2021

    Hi [mention:9ed33a015a2945d19640081ce816afa6:e9ed411860ed4f2ba0265705b8793d05],

    Try using a!sideBySideLayout() and add a checkbox field without a label next to your text field. They will look very close together exactly as you want them.

    ranjiths0003
    May 20, 2021

    Hi Srimathi,

    try below code

    a!localVariables(
      local!text,
      local!check,
      {
        a!sideBySideLayout(
          items: {
            a!sideBySideItem(
              item: a!textField(
                label: "TEXT :",
                labelPosition: "ADJACENT",
                readOnly: true,
                
              ),
              width: "MINIMIZE"
            ),
            a!sideBySideItem(
              item: a!checkboxField(
                choiceLabels: { "" },
                choiceValues: { true },
                value: local!check,
                saveInto: local!text,
                
              ),
              width: "MINIMIZE"
            ),
            a!sideBySideItem(
              item: a!textField(
                label: "",
                value: local!text,
                saveInto: local!text
              ),
              width: "MINIMIZE"
            ),
            
          },
          alignVertical: "BOTTOM"
        )
      }
    )
    
    

    December 19, 2022
    [deleted]
    Participating Frequently
    December 19, 2022