How to allow one checkbox selection to be made at a time in Orbeon

88 views
Skip to first unread message

Neenu Jacob

unread,
Aug 11, 2017, 5:51:40 AM8/11/17
to orb...@googlegroups.com
Hi,

How to make only one checkbox value selectable in Orbeon. which means allow
one selection to be made at a time (checkbox with the behaviour of
radiobutton). Please help me to achieve this.

Regards,
Neenu Jacob

--
View this message in context: http://discuss.orbeon.com/How-to-allow-one-checkbox-selection-to-be-made-at-a-time-in-Orbeon-tp4662696.html
Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.com.

Alessandro Vernet

unread,
Aug 18, 2017, 5:27:45 PM8/18/17
to orb...@googlegroups.com
Hi Neenu,

You could add a validation checking that at most one value is selected:
`count(xxf:split(.)) <= 1`. Or you could use radio buttons ;).

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
View this message in context: http://discuss.orbeon.com/How-to-allow-one-checkbox-selection-to-be-made-at-a-time-in-Orbeon-tp4662696p4662719.html

Neenu Jacob

unread,
Aug 22, 2017, 4:17:59 AM8/22/17
to orb...@googlegroups.com
The problem with radio buttons is that when you select one of the choices
(Example: Yes OR No) you can’t uncheck your selection! Sometimes a user will
check an answer by mistake then decide against it, either because he/she
don’t know the answer or not sure. So considering that, I decided to use the
checkboxes control (To allow the checking / unchecking behavior), however,
introduce additional logic to this control to only allow one selection to be
made at a time.

How can I achive this? Please answer

--
View this message in context: http://discuss.orbeon.com/How-to-allow-one-checkbox-selection-to-be-made-at-a-time-in-Orbeon-tp4662696p4662737.html

Alessandro Vernet

unread,
Aug 22, 2017, 2:47:15 PM8/22/17
to orb...@googlegroups.com
Got it Neenu. So using the validation expression mentioned in my last message
should do the trick. You'll let me know if this works for you.

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
View this message in context: http://discuss.orbeon.com/How-to-allow-one-checkbox-selection-to-be-made-at-a-time-in-Orbeon-tp4662696p4662741.html

Neenu Jacob

unread,
Aug 24, 2017, 1:50:55 AM8/24/17
to orb...@googlegroups.com
Hi Alex,

I need the exact behaviour of radiobutton. If we use validation expression
it shows error message when we check more than one checkbox. Instead of
that, need to uncheck the first one when i check the second one. Can I
achive this by implementing javascript? If yes, how can we implement js in
Orbeon.

Regards,
Neenu Jacob

--
View this message in context: http://discuss.orbeon.com/How-to-allow-one-checkbox-selection-to-be-made-at-a-time-in-Orbeon-tp4662696p4662747.html

Alessandro Vernet

unread,
Aug 24, 2017, 2:24:14 PM8/24/17
to orb...@googlegroups.com
Hi Neenu,

For those checkboxes, in Form Builder setting the calculated value as
`xxf:split()[1]` and the read-only as `false()`, as shown below, should do
the trick.

<http://discuss.orbeon.com/file/n4662751/Screen_Shot_2017-08-24_at_11.png>

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
View this message in context: http://discuss.orbeon.com/How-to-allow-one-checkbox-selection-to-be-made-at-a-time-in-Orbeon-tp4662696p4662751.html

Neenu Jacob

unread,
Aug 25, 2017, 6:24:09 AM8/25/17
to orb...@googlegroups.com

Hi Alex,

It is working. But additionally what I need is, when we click the one
checkbox the checked one should automatically uncheck. Please help me out to
solve this.

Regards,
Neenu Jacob

--
View this message in context: http://discuss.orbeon.com/How-to-allow-one-checkbox-selection-to-be-made-at-a-time-in-Orbeon-tp4662696p4662756.html

Alessandro Vernet

unread,
Aug 25, 2017, 1:06:10 PM8/25/17
to orb...@googlegroups.com
Hi Neenu,

You mean that if you have A and B, A is checked, and the user checks B,
you'd like B to stay checked, and A to become unchecked? I'm afraid you
can't do that in a declarative way using expressions in the Form Builder UI.
This means that users will have to uncheck A before they check B. Hopefully
they can live with it.

Alternatively, you could use radio buttons, and have a last (or first)
option that says "None of the above/following", or "No selection made", or
something similar. This is a more traditional way of solving this issue, and
also the solution that I would recommend.

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
View this message in context: http://discuss.orbeon.com/How-to-allow-one-checkbox-selection-to-be-made-at-a-time-in-Orbeon-tp4662696p4662758.html

khinkhi...@gmail.com

unread,
Jun 22, 2020, 12:10:15 PM6/22/20
to Orbeon Forms
Hi Alex, single checkbox in repeated grid like this, how to handle?

Alessandro Vernet

unread,
Jun 23, 2020, 12:59:50 AM6/23/20
to orb...@googlegroups.com
Hi khinkhinygn1996,

Could describe in more details what you are trying to do, what you've done
so far, and what doesn't work, if possible sharing some screenshots for
illustration?

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/
Reply all
Reply to author
Forward
0 new messages