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

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Neenu Jacob
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
Reply | Threaded
Open this post in threaded view
|

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

Alessandro  Vernet
Administrator
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
Reply | Threaded
Open this post in threaded view
|

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

Neenu Jacob
This post was updated on .
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.

Can I achive this by implementing javascript as mentioned in the below link? Please answer

https://doc.orbeon.com/xforms/xbl/javascript.html#with-orbeon-forms-20161-and-newer
Reply | Threaded
Open this post in threaded view
|

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

Alessandro  Vernet
Administrator
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
Reply | Threaded
Open this post in threaded view
|

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

Neenu Jacob
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
Reply | Threaded
Open this post in threaded view
|

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

Alessandro  Vernet
Administrator
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.



Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

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

Neenu Jacob

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
Reply | Threaded
Open this post in threaded view
|

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

Alessandro  Vernet
Administrator
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
Reply | Threaded
Open this post in threaded view
|

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

khinkhinygn1996
Hi Alex, single checkbox in repeated grid like this, how to handle?

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/f66ec263-6542-41ef-a274-2d9d97d712f7o%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

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

Alessandro  Vernet
Administrator
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/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1592888388035-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet