Alert

I have 30 questions in a form out of which few are mandatory. If I miss any one of them and go for submit, I can get error message at the end of page (usually before submit button). It is very difficult to scroll up the page and find for the missing ques. Is there any way in where I can get an alert message in the center of the page/near the ques itself ? Please help ....

  Discussion posts and replies are publicly visible

Parents Reply
  • When you apply validations to both the fields themselves, and within a!formLayout's validations parameter, you will have error messages showing both underneath the field missing data, and at the bottom of the form.  Is that not enough for your requirement?  Note validation pop-ups are not available, but we can show any messages on screen.  

    a!localVariables(
      local!numberOfQuestions: 10,
      local!questions: 1+enumerate(local!numberOfQuestions),
      local!answers: repeat(local!numberOfQuestions,null),
      local!validations: reject(
        fn!isnull,
        a!forEach(
          items: local!answers,
          expression: if(rule!APN_isEmpty(fv!item),concat("Please answer question ",fv!index),null)
        )
      ),
      
      a!formLayout(
        contents: {
          a!forEach(
            items: local!questions,
            expression: a!textField(
              labelPosition: "ADJACENT",
              label: concat("Q",fv!item),
              value: local!answers[fv!index],
              saveInto: local!answers[fv!index],
              required: true
            )
          )
        },
        validations: local!validations,
        buttons: a!buttonLayout(
          primaryButtons: {
            a!buttonWidget(
              label: "Submit",
              submit: true
            )
          }
        )
      )
    )

Children