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
You can define specific validations for each component (see https://docs.appian.com/suite/help/21.1/recipe-use-validation-group-for-buttons-with-multiple-validation-rules.html for an example), as well as for forms, sections, and editable grids (see https://docs.appian.com/suite/help/21.1/Validation_Message.html). Using those would allow you to show the validation messages right where you want them.
Thanks Santander for your suggestions, I tried them out. But looks like validations makes sense only when we answer the ques. My use case is - if I miss answering any of the question, how to handle it immediately. It is also fine if I can get any kind of popup with the missed items while submitting the form.
Recently, in a similar situation, I tried to just add a sectionLayout to each question. Each section did a check whether any value for that question was entered. This shows a red bar in case the validation fails. Maybe this helps.
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 ) } ) ) )
Thank you so much Chris. Its clear and worked for me