How can I sum text box values on a page?
What it would need to do is allow me to put any number of checkboxes on a page, each with its own numerical value (such as 0, 1, 2, or 3), and when a submit button is pushed, it would total the value of all checked boxes. It would be used to create diagnostic questionnaires. That is, there would be a list of questions, and each question would have choices such as “never”, “sometimes”, and “always”. Never would be given a value of 0, Sometimes would be given a value of 2, and Always would be given a value of 3, etc. When the button is pushed, the value of all boxes checked would be totaled and the total would be displayed.
It would be especially great if instead of just showing the number it could show the number and display one of several prearranged messages depending on the answer. For example, if score is less than 20, message 1 is displayed…if it is between 20 and 30, message 2 is displayed, etc.
Different forms would have different numbers of check boxes and values, so it would need to be a “add the value of all boxes on this page” function. For example, some questionnaires might only have “yes” or “no” instead of “sometimes”, “always”, and “never”.
I have seen a clinic that uses a cgi script, to do this, but I want to find a client side way to do it that can be used without even the need for an internet connection.
Do you know of such an existing script or even what “category” I would need to search in? If it does not exist, and someone is kind enough to write it up for me, I’d be happy to share some ideas that will make it of good commercial value to others.