Set checkbox choices in runtime

16 views
Skip to first unread message

Mani

unread,
Jun 24, 2020, 10:59:15 PM6/24/20
to Orbeon Forms
Hi Alex - I have a situation where the radio button determines the number of choices displayed in a checkbox.


I'm using two checkbox controls to do this. Can we do the same with only one checkbox control and without using single checkbox controls or setting the values through service and action?

Thanks
Manish

Mani

unread,
Jun 30, 2020, 2:20:55 AM6/30/20
to Orbeon Forms
Hi Alex - Have you had a chance to look at this?

Alessandro Vernet

unread,
Jul 3, 2020, 6:15:49 PM7/3/20
to orb...@googlegroups.com
Hi Manish,

I'm sorry for the delay! You could certainly have an action that, upon the
value of the radio button changing, calls a service that return the list of
choices you need to have in the checkboxes. Or were you maybe looking for
something different?

‑Alex

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

Mani

unread,
Jul 6, 2020, 12:11:10 AM7/6/20
to Orbeon Forms
They are a set of static values and some of the values should be displayed/hidden based on the radio button. Is this possible without calling a service?

Alessandro Vernet

unread,
Jul 7, 2020, 1:02:48 AM7/7/20
to orb...@googlegroups.com
Hi Manish,

It isn't. Right now actions always call services. (And I understand in this
case this seems wasteful since you could hardcode the choices in the form.)
One trick we use sometimes is to have a service that always returns the same
thing, posting to an local built-in "echo" service, and have the filtering
done in the Choices XPath expression. See:

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

Also, here the source of the form: form.xml
<http://discuss.orbeon.com/file/t119778/form.xml>

You'll let me know if this works for your case.

Alessandro Vernet

unread,
Jul 16, 2020, 12:12:34 PM7/16/20
to orb...@googlegroups.com
Hi Manish,

Did you get a chance to try using a static service, and doing the filtering
in the Choices XPath expression? If so, did that work for you?
Reply all
Reply to author
Forward
0 new messages