How To display blanked mandatory fields name in bottom with mandatory fields being highlighted in red in interface

we have a requirement, where the user wants to see all the mandatory fields names, that is still blank at the bottom of the interface and also wanted to see the existing functionality of Appian, where while submitting the form, all mandatory fields are highlighted in red.

we have 6-7 UI, managed in a single interface, with the help of links, so we have achieved to display the blank out field names at the bottom of the interface, but now the Appian default functionality for highlighting the fields in red is not working.

I have used my expression rule to display the names of fields at the submit (boolean)function in the button field, so instead of directly mapping submit as true, we are checking our expression to check whether any field is still blank, if it is then displaying the names at the bottom of the interface.

so now, the only issue, we are facing here is, on the click of the submit button, the by default function to highlight the fields is not working,

Please let us know if anyone know the workaround

  Discussion posts and replies are publicly visible

Parents
  • I think it would help to share your SAIL expression. Usually validations are pretty straightforward: they trigger when (1) you have a submit button that has validate=true and (2) there is a validation error in the field (either the value is null when the field is required or the validations parameter returns a text string to display).

    Often issues with validations are due to the first item above - do you have your submit button set to validate?

  • if I set validate as true, then it won't be able to display the blank fields name at the bottom of the interface

  • set submit as true and write a form validation rule and call in validations.

    buttons: A!buutonLayout(
    primaryButtons: {

    a!buttonWidget(
    label: cons!PC_SUBMIT_BUTTON_LABEL,
    value: cons!PC_SUBMIT_BUTTON_LABEL,
    saveInto: ri!buttonVal,
    submit: true
    )

    }

    ),

    validations: rule!PC_validateForm(

    instSegAttribute: ri!instSegAttribute,
    instSegAttribute1: ri!instSegAttribute1,
    instSegAttribute2: ri!instSegAttribute2,
    instSegAttribute3: ri!instSegAttribute3

    )

    *****

    PC_validateForm:

    a!localvariables(

    local!validationresList: {

    if(rule!APN_isBlank(
    ri!instSegAttribute.field1
    ),
    "field1 is blank",
    null
    ),

    if(rule!APN_isBlank(
    ri!instSegAttribute.field2
    ),
    "field2 is blank",
    null
    )

    ...

    },

    fn!reject(
        fn!isnull,
        local!validationresList
      )

    )

    )

  • it's not working as expected, as  form validation is working directly without clicking on the button, and also, we can't even arrange that as horizontal way 

  • I'd suggest using the standard field level validations and then create your own "fake" validation that also displays the fields at the bottom. That way, you'll see the validations within each field using the out-of-the-box functionality, but you can customize your validation at the bottom however you want.

    For example, you could add some rich text at the bottom that displays a message like this:

    a!richTextDisplayField(
      value: {
        a!richTextItem(
          text: {
            "Please complete the following fields before continuing:"
          },
          color: "NEGATIVE",
          style: {
            "STRONG"
          }
        ),
        a!richTextItem(
          text: {
            char(10) & "Field 1"
          },
          color: "NEGATIVE",
          style: {
            "STRONG"
          },
          showWhen: isnull(ri!instSegAttribute.field1)
        ),
        a!richTextItem(
          text: {
            char(10) & "Field 2"
          },
          color: "NEGATIVE",
          style: {
            "STRONG"
          },
          showWhen: isnull(ri!instSegAttribute.field2)
        )
      },
      showWhen: or(
        isnull(ri!instSegAttribute.field1),
        isnull(ri!instSegAttribute.field2)
      )
    )

  • the problem of form validation is, at the opening of the form, the validation will be popped up, as in the starting the fields will be blank, that's not expected, the expectation is to display once the user clicks on the button

  • Oh I see what you mean - sorry I didn't fully understand before. I think in this case you just need to use the validation message function then at the form-level validation. This allows you to choose whether to show the message immediately or only on form submit - in your case you should choose form submit. See the documentation for more information.

  • 0
    Certified Lead Developer
    in reply to Peter Lewis

    Or you could also set the showWhen of the fake validation RichText to only display when local!pressedSubmit is true.  Then, configure one of the things the button at the bottom of the form does is to set local!pressedSubmit to true, then the fake validation will show.

    You can try copying the validation format, or you could possibly use a blank empty read-only textField that has Validations that display when the showWhen evaluates true and the validations are also true.

Reply
  • 0
    Certified Lead Developer
    in reply to Peter Lewis

    Or you could also set the showWhen of the fake validation RichText to only display when local!pressedSubmit is true.  Then, configure one of the things the button at the bottom of the form does is to set local!pressedSubmit to true, then the fake validation will show.

    You can try copying the validation format, or you could possibly use a blank empty read-only textField that has Validations that display when the showWhen evaluates true and the validations are also true.

Children
No Data