validation in Forms Builder

27 views
Skip to first unread message

jamar....@gmail.com

unread,
Jul 12, 2021, 10:52:17 PM7/12/21
to Orbeon Forms
I want to validate a field to only be an integer from 0 to 10, but only if the field is used (it can be left blank/empty). I can't seem to work out a formula that enables this in the validation if I leave it blank combined with the integer range. Can anyone help?
Regards
Jamian

jamar....@gmail.com

unread,
Jul 13, 2021, 12:16:43 AM7/13/21
to Orbeon Forms
I think I worked it out:
string-length(./string()) = 0 or (. ge 0 and . le 10)
seems to work but if anyone else has a better way please let me know!

Regards
Jamian

Alessandro Vernet

unread,
Jul 14, 2021, 1:14:20 AM7/14/21
to Orbeon Forms
Hi Jamian,

Yes, like you said, that is fine. Maybe instead of `string-length(./string()) = 0`, I would use `xxf:is-blank()`, which is a bit more high level, and will also consider characters like spaces and tabs to be blank.


-Alex

jamar....@gmail.com

unread,
Jul 14, 2021, 1:59:37 AM7/14/21
to Orbeon Forms
OK, great, I'll give that a go.
Thank you Alex!

Reply all
Reply to author
Forward
0 new messages