Validation on required fields

Hi,

I am trying to achieve default highlighting of empty required fields on interface load, without the need of additional user interaction, while the submit button should skip all of those validations.

Using the required function is not possible, since it triggers only on submit, while using validations would also be difficult, because they do not handle null values. Is there any way of achieving this in Appian?
 
Thanks in advance
 

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer
    Richard, based on my understanding, this is not possible. There are a couple of options you could use as workarounds:

    1. Add a "show requiredness" button at the top of the screen to highlight the required fields (set the button to validate but not submit). This would require additional user interaction, but should be able to achieve the rest of the desired behavior.
    2. Leverage placeholder text to display "(Required)" in the cells of required fields. While this wouldn't highlight in red, it would achieve the no additional user interaction requirement.

    I'm sure there are other workarounds, but these are a couple you could consider.
  • Would it work for your use case to display validation "errors" in a box layout above the grid?

     

  • 0
    Certified Lead Developer

    Hi richardf0001 highlighting an empty required field on-load is not possible but we can customize our design approach to achieve this requirement as mentioned below:

    /* Throwing Form Based Validation based on some certain conditions on load */
    load(
      local!email_txt,
      local!firstName_txt,
      a!formLayout(
        label: "Form Level Validation",
        contents: {
          a!columnsLayout(
            columns: {
              a!columnLayout(
                contents: {
                  a!textField(
                    label: "First Name",
                    required: true(),
                    value: local!firstName_txt,
                    saveInto: local!firstName_txt
                  )
                }
              ),
              a!columnLayout(
                contents: {
                  a!textField(
                    label: "Email ID",
                    value: local!email_txt,
                    saveInto: local!email_txt
                  )
                }
              )
            }
          )
        },
        buttons: {
          a!buttonLayout(
            primaryButtons: {
              a!buttonWidgetSubmit(
                label: "SUBMIT",
                style: "PRIMARY",
                skipValidation: true()
              )
            }
          )
        },
        validations: a!validationMessage(
          message: "First Name is Required",
          validateAfter: "REFRESH",
          showWhen: isnull(local!firstName_txt)
        )
      )
    )

    NOTE: We need to change the showWhen condition of validationMessage based on our requirement (Currently i have only considered one field as required and highlighted the error for the same i.e First name). Similarly you can implement this logic when you are working with Editable Grid having CDT (Multiple) as your rule input / variable.

    Also unless it's (skipping the validations upon Submit) not your business requirement, i wouldn't recommend opting for this approach.

    Hope this will help you.