Set checkbox choices in runtime

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

Set checkbox choices in runtime

mbojja
Hi Alex - I have a situation where the radio button determines the number of choices displayed in a checkbox.

Sample form - https://demo.orbeon.com/demo/fr/test/checkbox/new

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

--
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/4563dbd2-c6ef-40fd-a700-b2ed66bf5f5fo%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Set checkbox choices in runtime

mbojja
Hi Alex - Have you had a chance to look at this?

On Thursday, June 25, 2020 at 10:59:15 AM UTC+8, Mani wrote:
Hi Alex - I have a situation where the radio button determines the number of choices displayed in a checkbox.

Sample form - <a href="https://demo.orbeon.com/demo/fr/test/checkbox/new" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fdemo.orbeon.com%2Fdemo%2Ffr%2Ftest%2Fcheckbox%2Fnew\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH6c-dABV7KILtKacVAs9viZDbt8Q&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fdemo.orbeon.com%2Fdemo%2Ffr%2Ftest%2Fcheckbox%2Fnew\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH6c-dABV7KILtKacVAs9viZDbt8Q&#39;;return true;">https://demo.orbeon.com/demo/fr/test/checkbox/new

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

--
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/3bf66a97-fdac-4a91-aab4-26d49605deaco%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Set checkbox choices in runtime

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

--
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/1593814548265-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Set checkbox choices in runtime

mbojja
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?

On Saturday, July 4, 2020 at 6:15:49 AM UTC+8, Alessandro Vernet wrote:
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: <a href="http://discuss.orbeon.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdiscuss.orbeon.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF5V5zfD-87RVoalaG4cqO_RzdDcA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdiscuss.orbeon.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF5V5zfD-87RVoalaG4cqO_RzdDcA&#39;;return true;">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/52d31333-fa93-47c1-bb72-bd3889a74d7eo%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Set checkbox choices in runtime

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

‑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/1594098165949-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet