Is there any way in the webform module, to cause elements, or perhaps all those belonging to a fieldset, to be hidden if a certain value is set in a previous element?
Basically, a section such as:
Are you filling this out on behalf of someone else? yes/no checkbox
Pagebreak element
You indicated that you are filling this out on behalf of someone else. Please answer these 10 questions.
pagebreak element
The part after the first pagebreak, and including the second pagebreak, would not even show up if the user checked "no" on the checkbox.
Luke
Is there any way in the webform module, to cause elements, or perhaps all those belonging to a fieldset, to be hidden if a certain value is set in a previous element?
Yes, there is a way. It's called Google. Try this:
http://www.google.com/search?q=Conditional+webform+elements+drupal
I just searched on your Subject line plus "Drupal" and the second result is the Webform Conditional module.
F
Actually, the first is closer to my issue's parameters (JS or CSS tricks are not desired; multipage support is). http://drupal.org/node/254728
What I ended up doing was this bit of clugieness:
A question on page 3 of my form was a yes/no radio set. On the following page, I inserted several fields as follows:
1. Markup field containing: <?php /* Hides these fields conditionally... */
if ($_REQUEST['submitted']['field_group_id']['y/n_item_id'] === no) { echo "<!-- Hide the following fields because they do not apply:"; } ?>
2. A fieldset, and several other fields, which should be viewed upon a "yes" condition to that first radiobutton set.
3. Another markup field: <?php /* Comment */
if ($_REQUEST['submitted']['field_group_id']['y/n_item_id'] === "no") { echo "-->"; } ?>
4. Another markup field, which just showed the user a "this is the last page, click finish" message. That, of course, displays no matter what 1-3 does.
This only works if the conditional being tracked, appears on the immediately preceeding page. I don't know why, but there seems to be no way to access field data from behind earlier pagebreaks. At least, from what I recall of my variable dump tests. I guess it's storing them in the session?
Anyway, maybe this hack job helps someone.:)
Luke
On Fri, 16 Apr 2010, Fred Jones wrote:
Is there any way in the webform module, to cause elements, or perhaps all those belonging to a fieldset, to be hidden if a certain value is set in a previous element?
Yes, there is a way. It's called Google. Try this:
http://www.google.com/search?q=Conditional+webform+elements+drupal
I just searched on your Subject line plus "Drupal" and the second result is the Webform Conditional module.
F
Luke wrote:
This only works if the conditional being tracked, appears on the immediately preceeding page. I don't know why, but there seems to be no way to access field data from behind earlier pagebreaks. At least, from what I recall of my variable dump tests. I guess it's storing them in the session?
You might get inspiration from what I'm doing in the Advanced User[1] 3.x version of the module.
[1] http://drupal.org/project/advuser