[support] Conditional webform elements?

Luke drupal at lists.tacticus.com
Fri Apr 16 13:38:17 UTC 2010


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
>


More information about the support mailing list