Multiple validations

24 views
Skip to first unread message

Mani

unread,
Apr 17, 2020, 3:04:58 AM4/17/20
to Orbeon Forms
Hi Alex - If there are multiple validations on a field, is there a way to validate in an order and display error messages accordingly instead of displaying all at once?

Thanks
multiple validations.PNG

Alessandro Vernet

unread,
Apr 20, 2020, 5:41:16 PM4/20/20
to orb...@googlegroups.com
Hi Manish,

You can't define an order through the UI, but you can do so through your
XPath expressions. Say you have 3 XPath expressions: `a`, `b`, and `c`, then
you can rewrite them as `a` (unchanged), `b and not(a)`, `c and not(a) and
not (b)`. This way, at most one error will show, and if there are multiple
problems, they will show in the order you specified. You'll let me know if
this works for you!

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

Mani

unread,
Jun 18, 2020, 2:06:50 AM6/18/20
to Orbeon Forms
Hi Alex - How do we prioritize the validation order of "date of birth" in the attached sample form

Thanks
Validation priority

Alessandro Vernet

unread,
Jun 19, 2020, 2:14:06 AM6/19/20
to orb...@googlegroups.com
Hi Manish,

Let me elaborate on my earlier example. Say you have three conditions you
want to be true, and for each one a message:

- 1. XPath: x1, message: m1
- 2. XPath: x2, message: m2
- 3. XPath: x3, message: m3

Then, in Form Builder, you enter the following constraints:

1. x1 ⇒ m1
2. x2 and not(x1) ⇒ m2
3. x3 and not(x2) and not (x1) ⇒ m3

This way only one message is shown at any given time, and you can control
the order in which the messages are shown if there are multiple errors.

Alessandro Vernet

unread,
Jun 26, 2020, 7:50:42 PM6/26/20
to orb...@googlegroups.com
Hi Manish, do the XPath expressions I mentioned make sense? Would this work
in your case?
Reply all
Reply to author
Forward
0 new messages