I've a webform which is used as a questionnaire. It uses page breaks to break up the questions. Depending on previous answers, sometimes you want to skip a whole lot of questions. You can do that with the new conditionals, but this becomes unwieldy when you want to skip 10 questions.

I've therefore implemented a "skip-to" action which can skip several questions in a row.

As this might be useful for others, the patch follows in the first comment.

Comments

berenddeboer’s picture

StatusFileSize
new5.03 KB

And here the patch.

berenddeboer’s picture

StatusFileSize
new6.13 KB

Oops, had left some debug code. This patch is better, and behavior is slightly optimised. The only thing to be aware of is one must select the preceding page break to skip to, not the question itself.

berenddeboer’s picture

StatusFileSize
new6.2 KB

And more bug fix.

quicksketch’s picture

Thanks for the patch! Overall, I'm not 100% sure about this approach, but if it were integrated it would at least need:

1) To restrict the list of options (via JavaScript) to just page breaks when using "skip-to". It doesn't make any sense to show users options that don't work. PHP validation should also be in place to prevent saving the form if an invalid (non-pagebreak) option is selected.
2) To follow coding standards. See http://drupal.org/coding-standards.

berenddeboer’s picture

Status: Needs review » Needs work
StatusFileSize
new7.04 KB

Thanks for the quick feedback quicksketch. I've attached a patch that takes care of 2 and does the php error handling of 1. Need a bit more free time for the javascript patch.

berenddeboer’s picture

Issue summary: View changes
StatusFileSize
new7.55 KB

Updated against latest webform.

xadag’s picture

Do you think this patch is compatible with the 4.1 branch because some part of the code didn't match any part of the new code in the 4.1 branch

Thanks.

danchadwick’s picture

Status: Needs work » Closed (won't fix)

You can hide entire pages by hiding the page break. Not sure if that helps. That notwithstanding, I don't see this being implemented. I don't see the corresponding jQuery code in the patch, which is needed to work intra-page.

I am also not convinced that "skip to" is the right UI element. I can imagine selecting a set of components to be hidden at once, however. I suspect that has nasty data structure ramifications, however.