View Full Version : Form With If Functions

06-28-2007, 03:26 PM

this is my first thread so apologies if i do not provide enough information

I would like to create a questionnaire style form that can calculate a score based on an individuals answers.

I anticipate the form having simple questions with only yes or no anwsers. I was thinking of using tick boxes for yes or no anwsers but whatever works wld be fine.

Eg. do you own a car? then the user either clicks on the yes box or the no box

I would like around 10 questions and each questions answer to have a score of 1

Then after answering the ten questions the user can be given a score eg. 7

I know how to do this in excel using IF functions but when I inserted the table in BV i could not edit any values when previewing so i presume this will not work if i publish.

I would like to know how to achieve the above as simply as possible any help would be great, thanks

06-28-2007, 06:03 PM
There are ways of transforming an excel form so that it will preserve the functions (they are converted in Javascript functions). See http://www.dbtechnosystems.com/formaexcel1.html where the form is updated realtime.

However, if you don't mind refreshing the page, it can also be done using a simple php script that will receive the form values, and it will simply add the values received. To do it easily, Radio buttons should be used instead of checkboxes, with a value of "1" assigned to the radio button corresponding to the "Yes" and a value of "0" assigned to the radio buttons corresponding to he "No".

06-29-2007, 09:05 PM
Thanks very much for your help, navaldesign. Refreshing the page is not a problem, so I have made a trail form with the radio buttons assigned the values to the yes and no. I have no clue how to use php and I have been searching the internet on how to create the code that I need. I presume that it is quite a stragithforward one as its only adding. If you could point me in the right direction that would be a massive help, thanks.

06-29-2007, 09:10 PM
Please post a link to the form and i will see what i can do

06-30-2007, 07:36 PM
hi, thanks, I have put a form up at www.homecure.co.uk/form.html (http://www.homecure.co.uk/form.html) I intend to make a health questionnaire from which people can answer a lot of questions and then have a score, but it is identical format to the one on the page just different text and more questions. Cheers for your help.

06-30-2007, 09:22 PM
Start changing your radio buttons Group names. Each pair of radio buttons must have the same Group name. The one corresponding to "Yes" will have value 1, the others, corresponding to "No" will have value 0.

However, this is not absolute, because it depends on the nature of the questions. In the example you have posted, one f the questions (Are you overweight ?) should (in my opinion) have opposite effect (Yes = 0 No = 1)

Anyway, please let me know if you need to display the result in a new page or have it emailed to you, so i can fix it.

Also, let me know if you want simply displayed the result of the "Yes" addition or you want the result of the "Yes" minus "No"s.

06-30-2007, 10:32 PM
Ok, have changed radio buttons to now 2 groups Yes and No with the values 1 and 0 respectively. It is a good point you make about the overweight question so I have rephrased it.
I would like the results to display on the same page so that when they click submit they can see the score straight away.
If the answer could be displayed as just a total but it is worked out by adding the yes's and taking away the no's that would be great because then I could have flexibility to assign different value to yes's and no's if needs be. Thanks very much.

06-30-2007, 11:17 PM
Have a look at http://www.dbtechnosystems.com/Tips/score1.php

If that's what you want, contact me through the form in my site and i will send you the file.

07-01-2007, 10:19 AM
Yes, thats absolutely fantastic thanks, exactly what I was looking for, thanks for all your help, have contacted you through form