Quantcast

Number of checked Checkboxes

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Number of checked Checkboxes

bruno.buzzi
Hi All,

A form has a list of checkboxes (so the user can select more than one).

It is possible with a XPath function to get the number of selected checkboxes at runtime.
(we want the user to select no more that 3 checkboxes)

regards,
bruno
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Number of checked Checkboxes

Alessandro  Vernet
Administrator
Hi Bruno,

Assuming you're using Form Builder, if the field with the checkboxes is named `choices`, then the following expression should do the trick:

count(xxf:split($choices))

I've also put the source of a form you can run to test this on:
https://gist.github.com/avernet/721f2c16f8efcf2b31532129a1382dcf

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

Re: Number of checked Checkboxes

bruno.buzzi
Alex,

Excellent ! That's exactly what i wanted :)

Regards
Bruno
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Number of checked Checkboxes

Alessandro  Vernet
Administrator
Bruno, good; I'm glad it helped, and thank you for the update.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Loading...