Feasibility - Count Checkmarks on a form

cmendla

Member
I'm sure this can be done but I'd like to have a form with about 20 items with checkboxes.. When the user clicks 'submit' they get a result depending on how many boxes they checked... somthing like

You checked 18 of 20 items, you really need our help now

- or-

You checked 3 of 20 items - It looks like you are doing great.


I haven't started to play with this yet but I was wondering if anyone has already done something like this.

thanks

chris
 
I would be surprised if there is already some example code in the forums.

You don't specify what should happen to the form when the user clicks submit. Do all the items need to be checked before the form submits or does the form submit anyway and the result provided afterwards?

Your example suggests that less 'checks' are better so I'm not sure what the form is doing.
 
I did something like this using javascript.

I have a databasejoin element which is rendered as a multicheckbox

I then have a regular field element called 'Count'.

The following javescript in the databasejoin element is used with event set to 'click' to update the 'Count' field each time a checkbox is clicked or unclicked:

Code:
var numChecked = this._getSubElements().filter(function (c) {return c.value !== "0" ? c.checked : false}).length;
Fabrik.getBlock("form_1").elements.get("jos___Count").update(numChecked) ;

Paul Hughes
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top