Skip to main content
Known Participant
Nov 27, 2023 10:55 AM UTC
Question

Required is not working in Grid

Required is not working for dropdown field in gridrow layout how can i resolve this ?

 a!gridLayout(
        label: "",
        labelPosition: "ABOVE",
        headerCells: {
          a!gridLayoutHeaderCell(label: ""),
          a!gridLayoutHeaderCell(label: "")
        },
        columnConfigs: {
          a!gridLayoutColumnConfig(weight: 3),
          a!gridLayoutColumnConfig(weight: 3)
        },
        rows: {
          a!gridRowLayout(
            contents: {
              a!textField(
                value: "Grantee Administrator (Primary Contact)",
                readOnly: true(),
                required: true()
              ),
              a!textField(
                showWhen: rule!SCO_isBoolNotEmptyAndTrue(ri!hasUserClickedGeneratePdf),
                readOnly: true,
                label: rule!GAI_utilFormatUserName(
                  ri!applnProjectInfo['recordType!{ba1b9bf5-818d-401c-b540-67788e6d7d2d}GAI Application Project Info.fields.{8852265a-0704-4a43-829a-c4828abf7234}usernameGranteeAdmin']
                )
              ),
              a!dropdownField(
                showWhen: rule!SCO_isBoolBlankOrEmptyOrFalse(ri!hasUserClickedGeneratePdf),
                placeholder: "---Select a value ---",
                choiceLabels: a!forEach(
                  items: local!granteeAdminUsers,
                  expression: rule!GAI_utilFormatUserName(usrName: fv!item)
                ),
                choiceValues: local!granteeAdminUsers,

                value: if(
                  or(
                    a!isNullOrEmpty(
                      ri!applnProjectInfo['recordType!{ba1b9bf5-818d-401c-b540-67788e6d7d2d}GAI Application Project Info.fields.{8852265a-0704-4a43-829a-c4828abf7234}usernameGranteeAdmin']
                    ),
                    a!isNullOrEmpty(local!granteeAdminUsers)
                  ),
                  null,
                  if(
                    contains(
                      local!granteeAdminUsers,
                      ri!applnProjectInfo['recordType!{ba1b9bf5-818d-401c-b540-67788e6d7d2d}GAI Application Project Info.fields.{8852265a-0704-4a43-829a-c4828abf7234}usernameGranteeAdmin']
                    ),
                    ri!applnProjectInfo['recordType!{ba1b9bf5-818d-401c-b540-67788e6d7d2d}GAI Application Project Info.fields.{8852265a-0704-4a43-829a-c4828abf7234}usernameGranteeAdmin'],
                    null
                  )
                ),
                saveInto: ri!applnProjectInfo['recordType!{ba1b9bf5-818d-401c-b540-67788e6d7d2d}GAI Application Project Info.fields.{8852265a-0704-4a43-829a-c4828abf7234}usernameGranteeAdmin'],
                required: true(),
                
              )
            }
          ),
          a!gridRowLayout(
            contents: {
              a!textField(
                value: "Grantee Financial Point of Contact",
                readOnly: true(),
                
              ),
              a!textField(
                showWhen: rule!SCO_isBoolNotEmptyAndTrue(ri!hasUserClickedGeneratePdf),
                readOnly: true,
                label: rule!GAI_utilFormatUserName(
                  ri!applnProjectInfo['recordType!{ba1b9bf5-818d-401c-b540-67788e6d7d2d}GAI Application Project Info.fields.{2409b484-c88f-406c-bacf-8094aabea5c7}usernameGranteeFiscalStaff']
                )
              ),
              a!dropdownField(
                showWhen: rule!SCO_isBoolBlankOrEmptyOrFalse(ri!hasUserClickedGeneratePdf),
                placeholder: "---Select a value ---",
                choiceLabels: a!forEach(
                  items: local!granteeFinancialUsers,
                  expression: rule!GAI_utilFormatUserName(usrName: fv!item)
                ),
                choiceValues: local!granteeFinancialUsers,

                value: if(
                  or(
                    a!isNullOrEmpty(
                      ri!applnProjectInfo['recordType!{ba1b9bf5-818d-401c-b540-67788e6d7d2d}GAI Application Project Info.fields.{2409b484-c88f-406c-bacf-8094aabea5c7}usernameGranteeFiscalStaff']
                    ),
                    a!isNullOrEmpty(local!granteeFinancialUsers)
                  ),
                  null,
                  if(
                    contains(
                      local!granteeFinancialUsers,
                      ri!applnProjectInfo['recordType!{ba1b9bf5-818d-401c-b540-67788e6d7d2d}GAI Application Project Info.fields.{2409b484-c88f-406c-bacf-8094aabea5c7}usernameGranteeFiscalStaff']
                    ),
                    ri!applnProjectInfo['recordType!{ba1b9bf5-818d-401c-b540-67788e6d7d2d}GAI Application Project Info.fields.{2409b484-c88f-406c-bacf-8094aabea5c7}usernameGranteeFiscalStaff'],
                    null
                  )
                ),
                saveInto: ri!applnProjectInfo['recordType!{ba1b9bf5-818d-401c-b540-67788e6d7d2d}GAI Application Project Info.fields.{2409b484-c88f-406c-bacf-8094aabea5c7}usernameGranteeFiscalStaff'],
                required: true(),
                requiredMessage: "no"
                
              )
            }
          ),
          a!gridRowLayout(
            contents: {
              a!textField(
                value: "Grantee Authorized Official",
                readOnly: true(),
                
              ),
              a!textField(
                showWhen: rule!SCO_isBoolNotEmptyAndTrue(ri!hasUserClickedGeneratePdf),
                readOnly: true,
                label: rule!GAI_utilFormatUserName(
                  ri!applnProjectInfo['recordType!{ba1b9bf5-818d-401c-b540-67788e6d7d2d}GAI Application Project Info.fields.{ce32e7a4-2cc9-4a47-8f91-2f80f075469a}usernameGranteeAuthOfficial']
                )
              ),
              a!dropdownField(
                showWhen: rule!SCO_isBoolBlankOrEmptyOrFalse(ri!hasUserClickedGeneratePdf),
                placeholder: "---Select a value ---",
                choiceLabels: a!forEach(
                  items: local!granteeAuthOfficials,
                  expression: rule!GAI_utilFormatUserName(usrName: fv!item)
                ),
                choiceValues: local!granteeAuthOfficials,

                value: if(
                  or(
                    a!isNullOrEmpty(
                      ri!applnProjectInfo['recordType!{ba1b9bf5-818d-401c-b540-67788e6d7d2d}GAI Application Project Info.fields.{ce32e7a4-2cc9-4a47-8f91-2f80f075469a}usernameGranteeAuthOfficial']
                    ),
                    a!isNullOrEmpty(local!granteeAuthOfficials)
                  ),
                  null,
                  if(
                    contains(
                      local!granteeAuthOfficials,
                      ri!applnProjectInfo['recordType!{ba1b9bf5-818d-401c-b540-67788e6d7d2d}GAI Application Project Info.fields.{ce32e7a4-2cc9-4a47-8f91-2f80f075469a}usernameGranteeAuthOfficial']
                    ),
                    ri!applnProjectInfo['recordType!{ba1b9bf5-818d-401c-b540-67788e6d7d2d}GAI Application Project Info.fields.{ce32e7a4-2cc9-4a47-8f91-2f80f075469a}usernameGranteeAuthOfficial'],
                    null
                  )
                ),
                saveInto: ri!applnProjectInfo['recordType!{ba1b9bf5-818d-401c-b540-67788e6d7d2d}GAI Application Project Info.fields.{ce32e7a4-2cc9-4a47-8f91-2f80f075469a}usernameGranteeAuthOfficial'],
                required: true(),
                
              )
            }
          )
        },
        shadeAlternateRows: true
      ),

7 replies

stefanhelzle0001
Brainy
Nov 27, 2023 12:00 PM UTC

Required IS working in grids. How do you test it?

Known Participant
Nov 27, 2023 12:33 PM UTC

if i am giving required:true, it's not woking why i don't know

stefanhelzle0001
Brainy
Nov 27, 2023 12:44 PM UTC

What exactly is not working? Please share all the gory details.

Did you enable validation on the button?

Do you have any required fields outside the grid? Do they work?

jayaprakashr0001
Participating Frequently
Nov 27, 2023 12:36 PM UTC

Hi sudhirs4981,

Adding to Stefan , it will work or you are looking for the * mark for required fields. If not can you explain more about the issue/requirement.

Known Participant
Nov 27, 2023 12:52 PM UTC

HII  jayapraksh,

i am looking for *, it is not visible, and without select any value from dropdown i am able to procced even i have given required :true only , you can see my code above

stewart.burchell
Employee
Nov 27, 2023 1:36 PM UTC

Because your dropdowns are in a grid they are not marked with an asterisk as the label is in the column header, but each row might have different required statuses. What you should see instead is the fields outlined in red when you hit the "Submit" button: