Dropdown field should be mandatory in editable grid

Hi,

I have a scenario like:

I am using drop down field in grid layout and i have  made it as required field.

without entering any value, when i am submitting the form,  though the form was not submitting but it is not populating with red colored field.

Kindly help me on this?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Can you share a code snippet for what you have so far, so that we can help troubleshoot?

    When I try it, I'm able to fairly easily make a dropdown field show a 'required' validation upon form submit when not populated with a value.  See screenshot:

    Example code for the above screenshot:

    load(
      local!dropdownValue,
      
      a!sectionLayout(
        label: "Editable Grid",
        contents: {
          a!gridLayout(
            headerCells: {a!gridLayoutHeaderCell(label: "Text"), a!gridLayoutHeaderCell(label: "Dropdown")},
            rows: {
              a!gridRowLayout(
                contents: {
                  a!textField(
                    value: "Read-only text",
                    readOnly: true()
                  ),
                  a!dropdownField(
                    choiceLabels: {"Choice 1", "Choice 2", "Choice 3"},
                    choiceValues: {1, 2, 3},
                    value: local!dropdownValue,
                    placeholderLabel: "--Choose a Value (Required)--",
                    required: true()
                  )
                }
              )
            }
          ),
          
          a!buttonArrayLayout(
            buttons: {
              a!buttonWidget(
                label: "Submit",
                value: "Submit",
                style: "PRIMARY",
                submit: true(),
                validate: true()
              )
            }
          )
        }
      )
    )

Reply
  • 0
    Certified Lead Developer

    Can you share a code snippet for what you have so far, so that we can help troubleshoot?

    When I try it, I'm able to fairly easily make a dropdown field show a 'required' validation upon form submit when not populated with a value.  See screenshot:

    Example code for the above screenshot:

    load(
      local!dropdownValue,
      
      a!sectionLayout(
        label: "Editable Grid",
        contents: {
          a!gridLayout(
            headerCells: {a!gridLayoutHeaderCell(label: "Text"), a!gridLayoutHeaderCell(label: "Dropdown")},
            rows: {
              a!gridRowLayout(
                contents: {
                  a!textField(
                    value: "Read-only text",
                    readOnly: true()
                  ),
                  a!dropdownField(
                    choiceLabels: {"Choice 1", "Choice 2", "Choice 3"},
                    choiceValues: {1, 2, 3},
                    value: local!dropdownValue,
                    placeholderLabel: "--Choose a Value (Required)--",
                    required: true()
                  )
                }
              )
            }
          ),
          
          a!buttonArrayLayout(
            buttons: {
              a!buttonWidget(
                label: "Submit",
                value: "Submit",
                style: "PRIMARY",
                submit: true(),
                validate: true()
              )
            }
          )
        }
      )
    )

Children
No Data