I am generating a questionnaire with a number of questions with yes, no, maybe type answers. Each answer needs to have a numeric equivalent ie
Yes(2) No(0) maybe(1)
or
Joe(1) Jane(1) David(1) None(0)
The competed form needs to give the user a score which is also stored and sent to the email recipient.
How would I go about adding this type of functionality?
Cheers
Conánn
contact@conann.com
Comments
Comment #1
conann commentedThe numeric values would be hidden from the user
Comment #2
quicksketchI know this was ages ago but I'm going through and cleaning up the issue queue.
Download webform 1.1 or later which includes two new fields in the 'Advanced' section of the webform node edit form. I'd create a hidden element called 'score' and leave it's value blank. In the additional processing field, you'll need to do a fair amount of custom PHP which tallies up the results. When you get a final score save the value for it in the hidden field you created.
To make the email look the way you'd like, you'll need to theme the output of the email by creating a _phptemplate_webform_create_mailmessage() function in your template.php file. Copy the existing theme_webform_create_mailmessage() function out of webform.inc and start with that to get an idea of what you can change.
Anyway, that's quite a bit of additional work for a webform, since this isn't the intended purpose. If this method won't work out for you, you're probably looking at creating a custom module for this functionality.
Comment #3
quicksketchThis also sounds a bit like quiz module. Which you might give a shot.
Comment #4
conann commentedQuiz module has some of the features but is to inflexible and relies on a % score. For example the following questionnaire http://jo.conann.com/dry-eye-questionnaire which is for a University research project users who score over 14 might require follow up treatment. This type of form scoring is very common in medical research and in education in general, where not all fields contribute to the score and not all scores are equal to 1. Ideally the form would be used by 10s of thousands of people who depending on their score would be sent to different destinations depending on their final score. Manually scoring each result ads to the expense of the research.
The advantage of using webform over a custom form is a researcher can build their own forms or make adjustments to the form to fine tune the research. For instance the same research (above) being done in India would use a different series of questions dependent on local environment. Not needing a developer to make these adjustment greatly lowers the cost of the research. Webforms result views are fantastic as they are but a score would be so nice.
For the most part only the select form type would be used for scoring as text fields not scored and used for additional information.
The webform module is the best I have seen across platforms and live results would push it over the edge. I am very willing to sponsor the the addition of this functionality and for it to stay within the open source drupal community.
I have a growing number of clients who are interested in the type of functionality both in education and medical research. Perhaps it needs an additional module like webform_report either way it would be great to explore the best way to achieve this type of functionality.
Any help with this would be greatly appreciated.
Comment #5
quicksketch