View Full Version : How can I sum text box values on a page?

01-20-2003, 01:41 AM
I am a school principal (with some web design experience), and I want to create an e-book type manual with questionnaires that can help my teachers to identify certain potential learning problems in children. I have spent days searching through javascript sites to find an existing script, but I haven’t found anything close. It seems like something that would be quick and easy for someone who knows javascript to find or write.

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.


01-20-2003, 02:04 AM
Just to get the terminology straight:

Checkbox provides a mechanism to enter a yes/no answer. For multiple choice answers, you would need to use radio-buttons or select boxes.

I'm not sure if you will be able to find a generic script to use in your application, but it sure not that hard to develop one.

As far as "e-book type manual" goes, you may find this (http://klproductions.com:8080/wdscp.html) helpfull.

01-20-2003, 04:40 AM
Email or message me, I'll be happy to help you with it personally - however I'll need to see what you have already developed (HTML etc.).

Anything aimed at spotting potential learning problems in children gets my attention, since I love to learn (something that fortunately I've never really had a problem with, although some of the people on this forum are light-years beyond me ;)), and I love to teach if I can.

When you can get someone else to truly understand something you already know, that's a pretty good reward. :)

02-10-2003, 07:42 AM
I've finally had a chance to email you more detailed info. I appreciate the offer!:)