Show all the mandatory fields at the end of the form

Certified Associate Developer

Hi,

I have a requirement which says, when a mandatory field is missed, there should be an error displayed at the bottom of the page with the missed field name so the user can see what has been missed without having to scroll up the page. Could anybody please suggest what's the best approach?

Thanks

  Discussion posts and replies are publicly visible

Parents
  • Hi Shruti,

    as far as i know there is not any automated way to do this so what i would do is to use validation messages:

    load(
      local!text,
      local!text2,
      a!formLayout(
        contents: {
          a!textField(
            label: "Text 1",
            required: true,
            value: local!text,
            saveInto: local!text
          ),
          a!textField(
            label: "Text 2",
            required: true,
            value: local!text2,
            saveInto: local!text2
          )
        },
        buttons: {
          a!buttonLayout(
            primaryButtons: {
              a!buttonWidgetSubmit(
                label: "SUBMIT"
              )
            }
          )
        },
        validations: {
          a!validationMessage(
            message: "Text 1 is missing",
            validateAfter: "SUBMIT",
            showWhen: or(isnull(local!text),local!text="")
          ),
          a!validationMessage(
            message: "Text 2 is missing",
            validateAfter: "SUBMIT",
            showWhen: or(isnull(local!text2),local!text2="")
          )
        }
      )
    )

    But maybe there is other, more sophisticated way, I don't know.

    Best,

    Erik

Reply
  • Hi Shruti,

    as far as i know there is not any automated way to do this so what i would do is to use validation messages:

    load(
      local!text,
      local!text2,
      a!formLayout(
        contents: {
          a!textField(
            label: "Text 1",
            required: true,
            value: local!text,
            saveInto: local!text
          ),
          a!textField(
            label: "Text 2",
            required: true,
            value: local!text2,
            saveInto: local!text2
          )
        },
        buttons: {
          a!buttonLayout(
            primaryButtons: {
              a!buttonWidgetSubmit(
                label: "SUBMIT"
              )
            }
          )
        },
        validations: {
          a!validationMessage(
            message: "Text 1 is missing",
            validateAfter: "SUBMIT",
            showWhen: or(isnull(local!text),local!text="")
          ),
          a!validationMessage(
            message: "Text 2 is missing",
            validateAfter: "SUBMIT",
            showWhen: or(isnull(local!text2),local!text2="")
          )
        }
      )
    )

    But maybe there is other, more sophisticated way, I don't know.

    Best,

    Erik

Children
No Data