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

Parents
  • 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.

Reply
  • 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.

Children
No Data