is Webform the best (drupal) way to create a simple guided entry/decision tree on a website e.g.

"My printer doesn't work!"
- Is the power on? (yes/no)
> NO > switch it on
> Yes > Is the Paper in the machine etc etc

By answering a series of questions you can guide to an end page that reflects the previous answers.

I thought about just using Book module but thought I would ask the community first
There are a couple of modules but only D6

Comments

quicksketch’s picture

Status: Active » Fixed

This could be possible in Webform merely by having a form with no final "submit" button. Using the conditionals tab, you could set up a series of rules that only show certain markup components based on the previously selected fields. Though Webform does not have any kind of "decision tree" functionality, if you base answers or questions off of a previous field having some value (and you default the field to having no value), then a field will only be shown if a previously shown question was also answered.

And of course if you're doing conditionals, I strongly suggest using the 4.x version of the module that has the new conditionals system. The 3.x branch definitely wouldn't cut it for this use-case.

Overall I'm not sure that this is the "best" solution, but as far as Webform goes, it's at least possible.

artatac’s picture

This is a great idea and working well. Is there a way of having no final submit button?

quicksketch’s picture

Is there a way of having no final submit button?

There isn't a built-in way of not having a submit button. You would have to hide it, either with CSS or through hook_form_alter() to remove the button. I suppose you could also use the theme layer to remove the button, using the instructions in THEMING.txt to override the webform-form-[nid].tpl.php for the form.

artatac’s picture

Thanks quicksketch, I did as suggested and the test result is at http://robsnursery.com/content/shall-i-buy-it
I created a new content type called Decision tree and used select options for the questions and markup for the various final recommendations .
Rather that use the form id (each time) I used css on node-type-decision-tree e.g:

.node-type-decision-tree .form-submit {
    display: none;
}

But I presume there is a way to adapt and rename one of the existing web form templates something like webform-node-type-decision-tree.tpl.php and then take out the submit button code.
It does exactly what I want so well done on the new conditional features

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.