How to handle checkboxes in rows of repeated grid

19 views
Skip to first unread message

shiningstar

unread,
Jun 22, 2020, 12:10:15 PM6/22/20
to orb...@googlegroups.com
<http://discuss.orbeon.com/file/t375838/Capture1.png>
Hi Alex,
Let me explain my requirement. I want to have only one check for first
choice in this repeated grid. I check first choice for 1st row of repeated
grid and then for 2nd row, I also check the first choice of 2nd row. As the
result, the 1st row of this grid will be automatically unchecked. Please
guide me. :D

--
Sent from: http://discuss.orbeon.com/

Alessandro Vernet

unread,
Jun 22, 2020, 10:52:54 PM6/22/20
to orb...@googlegroups.com
Hi Shine,

In Orbeon Forms, we don't recommend users interacting with one field changes
the value of another field (unless that other field is readonly), but you
can mark both fields invalid if they have the same value selected:

Exclusive_checkboxes.gif
<http://discuss.orbeon.com/file/t119778/Exclusive_checkboxes.gif>

Assuming your field is named `choice`, you can achieve this with the
following validation expression:

not(xxf:split(.) = (//choice except .)/xxf:split(.))

You'll let me know if this works for you!

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet

Alessandro Vernet

unread,
Jun 22, 2020, 11:07:27 PM6/22/20
to orb...@googlegroups.com
And the source of the form created for testing, in case you would like to run
it in Form Builder:

form.xml <http://discuss.orbeon.com/file/t119778/form.xml>

shiningstar

unread,
Jun 23, 2020, 4:20:36 AM6/23/20
to orb...@googlegroups.com

Alessandro Vernet

unread,
Jun 26, 2020, 9:20:56 PM6/26/20
to orb...@googlegroups.com
Hi Shine,

In the case of a single checkbox, I imagine that you want a most one line in
the repeated grid to have that checkbox checked, correct? If so, I think
pretty much the same expression would work, except you don't need to the
calls to `xxf:split()` in that case, that is: `not(. = (//choice except
.))`. Does that work for you?

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet

Alessandro Vernet

unread,
Jul 4, 2020, 1:11:07 AM7/4/20
to orb...@googlegroups.com
Hi Shine,

Did you get a chance to try that expression on a single checkbox? If so, did
it work for you?
Reply all
Reply to author
Forward
0 new messages