<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Empty grid validation message</title><link>https://community.appian.com/discussions/f/new-to-appian/28901/empty-grid-validation-message</link><description>i, I have a grid inside a form with &amp;quot;Submit&amp;quot; and &amp;quot;Cancel&amp;quot; button, where I am loading one row with required entry fields. Also there is an delete icon basides to that row to delete. 
 Now, when I try to submit the form in the browser url by clicking &amp;quot;Submit</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Empty grid validation message</title><link>https://community.appian.com/thread/114001?ContentTypeID=1</link><pubDate>Fri, 09 Jun 2023 14:18:59 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b69f534e-f6a2-4a6c-b312-3319f146c40b</guid><dc:creator>swapnar6405</dc:creator><description>&lt;p&gt;Thank you so much. It was a great help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Empty grid validation message</title><link>https://community.appian.com/thread/113997?ContentTypeID=1</link><pubDate>Fri, 09 Jun 2023 13:54:40 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b677886e-3173-4136-a048-1f1a568b6720</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Please check my reply above from yesterday evening, the thing I mentioned should cover this case, provided my assumptions were correct (you haven&amp;#39;t really specified some important details here so i&amp;#39;m left to guess...)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Empty grid validation message</title><link>https://community.appian.com/thread/113996?ContentTypeID=1</link><pubDate>Fri, 09 Jun 2023 13:53:09 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:510d70a6-de03-467e-9867-9fa71f25be5b</guid><dc:creator>swapnar6405</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;I have a SAIL form with attached code and also I have a process model with &amp;quot;Start Node&amp;quot; as the form.&lt;/p&gt;
&lt;p&gt;Now, when the user clicks on DELETE icon (red icon)&amp;nbsp;with default row and clicks on Submit button, we would like to display an ERROR message and stop the form submission.&lt;/p&gt;
&lt;p&gt;Any advises please.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(

  local!employees: {
    a!map( id: 1, firstName: &amp;quot;John&amp;quot; , lastName: &amp;quot;Smith&amp;quot; , department: &amp;quot;Engineering&amp;quot; , title: &amp;quot;Director&amp;quot; , phoneNumber: &amp;quot;555-123-4567&amp;quot; , startDate: today()-360 ),
  },
  a!formLayout(
    label: &amp;quot;Add or Update Employee Data&amp;quot;,
    instructions: &amp;quot;Add, edit, or remove Employee data in an inline editable grid&amp;quot;,
    contents: {
      a!gridLayout(
        totalCount: count(local!employees),
        headerCells: {
          a!gridLayoutHeaderCell(label: &amp;quot;First Name&amp;quot; ),
          a!gridLayoutHeaderCell(label: &amp;quot;Last Name&amp;quot; ),

          /* For the &amp;quot;Remove&amp;quot; column */
          a!gridLayoutHeaderCell(label: &amp;quot;&amp;quot; )
        },
        /* Only needed when some columns need to be narrow */
        columnConfigs: {
          a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;, weight:3 ),
          a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;, weight:3 ),

          a!gridLayoutColumnConfig(width: &amp;quot;ICON&amp;quot;)
        },
        rows: a!forEach(
          items: local!employees,
          expression: a!gridRowLayout(
            contents: {
              /* For the First Name Column*/
              a!textField(
                /* Labels are not visible in grid cells but are necessary to meet accessibility requirements */
                label: &amp;quot;first name &amp;quot; &amp;amp; fv!index,
                value: fv!item.firstName,
                saveInto: fv!item.firstName,
                required: true
              ),
              /* For the Last Name Column*/
              a!textField(
                label: &amp;quot;last name &amp;quot; &amp;amp; fv!index,
                value: fv!item.lastName,
                saveInto: fv!item.lastName,
                required:true
              ),
              /* For the Removal Column*/
              a!richTextDisplayField(               
                value: a!richTextIcon(
                  icon: &amp;quot;close&amp;quot;,
                  altText: &amp;quot;delete &amp;quot; &amp;amp; fv!index,
                  caption: &amp;quot;Remove &amp;quot; &amp;amp; fv!item.firstName &amp;amp; &amp;quot; &amp;quot; &amp;amp; fv!item.lastName,
                  link: a!dynamicLink(
                    value: fv!index,
                    saveInto: {
                      a!save(local!employees, remove(local!employees, save!value))
                    }
                  ),
                  linkStyle: &amp;quot;STANDALONE&amp;quot;,
                  color: &amp;quot;NEGATIVE&amp;quot;
                )
              )
            },
            id: fv!index
          )
        ),
        addRowlink: a!dynamicLink(
          label: &amp;quot;Add Employee&amp;quot;,

          saveInto: {
            a!save(local!employees, append(local!employees, save!value))
          }
        ),
        rowHeader: 1
      )
    },
    buttons: a!buttonLayout(
      primaryButtons: a!buttonWidget(
        label: &amp;quot;Submit&amp;quot;,
        submit: true
      )
    )
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/62/pastedimage1686318783037v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Empty grid validation message</title><link>https://community.appian.com/thread/113961?ContentTypeID=1</link><pubDate>Fri, 09 Jun 2023 04:46:59 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b977890b-90d4-442b-9221-d332cd409d40</guid><dc:creator>Harshit Bumb (Appyzie)</dc:creator><description>&lt;p&gt;You add those validations on the individual components like text field, dropdown field etc. And set the button&amp;#39;s validate: true. That should get you covered.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Empty grid validation message</title><link>https://community.appian.com/thread/113952?ContentTypeID=1</link><pubDate>Thu, 08 Jun 2023 21:00:49 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c25f50ed-7d5e-4b69-a8d2-756d2d15f102</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Are you saying you want there to be a validation shown if the user tries to submit an empty Grid, and your current validations are row-level (and thus not shown when no rows are present)?&lt;/p&gt;
&lt;p&gt;If my guess above is correct - I suggest you &lt;span style="text-decoration:line-through;"&gt;look into section-level validations, and&lt;/span&gt; &lt;span style="text-decoration:underline;"&gt;&lt;em&gt;&lt;strong&gt;utilize a!validationMessage()&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt; (which you can set to fire at submit time), and its condition will check whether no data rows are present.&lt;/p&gt;
&lt;p&gt;Edit: I forgot, a!validationMessage() is also valid in an Editable Grid, which is perfect for this use case.&amp;nbsp; Thanks for providing your code below, here&amp;#39;s the same but with my small addition:&lt;br /&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/62/pastedimage1686319136840v1.png" /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="java"&gt;a!localVariables(

  local!employees: {
    a!map( id: 1, firstName: &amp;quot;John&amp;quot; , lastName: &amp;quot;Smith&amp;quot; , department: &amp;quot;Engineering&amp;quot; , title: &amp;quot;Director&amp;quot; , phoneNumber: &amp;quot;555-123-4567&amp;quot; , startDate: today()-360 ),
  },
  a!formLayout(
    label: &amp;quot;Add or Update Employee Data&amp;quot;,
    instructions: &amp;quot;Add, edit, or remove Employee data in an inline editable grid&amp;quot;,
    contents: {
      a!gridLayout(
        totalCount: count(local!employees),
        headerCells: {...},
        /* Only needed when some columns need to be narrow */
        columnConfigs: {...},
        rows: a!forEach(...),
        addRowlink: a!dynamicLink(...),
        rowHeader: 1,
        
        /* ADDED VALIDATION PARAMETER */
        validations: {
          a!validationMessage(
            message: &amp;quot;At least one row is required.&amp;quot;,
            showWhen: a!isNullOrEmpty(local!employees),
            validateAfter: &amp;quot;SUBMIT&amp;quot;
          )
        }
        
        
      )
    },
    buttons: a!buttonLayout(...)
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>