Closed (fixed)
Project:
Webform
Version:
6.x-3.0-beta4
Component:
User interface
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
12 Apr 2010 at 18:38 UTC
Updated:
18 Aug 2010 at 01:44 UTC
Hello, does anyone knows how can I achieve the following functionality using Webform 3?
1) User selects option from a drop down select box
2) Another select box is populated using the value from first select
Example: User selects a country from list of countries, then the second box populates with the cities for that particular selected country.
Do I need to create a multistep form to achieve the desired functionality?
Thanks
Comments
Comment #1
Eldeem commentedYou can try using webform conditional module.
http://drupal.org/project/webform_conditional
However, I'm not sure that it is the best way to do it.
Comment #2
quicksketchYeah you'd have to either use a multi-page form or webform_conditional and build a different select list for each possible option in the first select list. Also see the official feature request for exactly what you're requesting: #329504: Hierarchical Select Lists.
Comment #3
luthien commentedDo you know what complicates things for me if I use http://drupal.org/project/webform_conditional? the fact that I'm using the dynamic_select module to populate my select box. The second select will be another dynamic_select box. It is an extreme example of a hierarchical select list but dynamically generated. I basically need to pass the value from first select box to the query in second box and the array will be automatically generated without the need of creating a different list for each option.
Comment #4
luthien commentedquicksketch, how do I pass a value selected in step 1 of a multistep form to the second step's url?
Comment #5
quicksketchAll of the previous steps data will be available in $form_state['storage'], but I don't know how that would factor into your custom PHP code or if $form_state is even available in a dynamic_select. You're best off asking the developer of that component, since I don't really endorse use of it.
Comment #6
luthien commentedTemporary solution using multistep form:
1) created the first "dynamic select"
2) added a page break
3) populated the second "dynamic select" passing this value from 1):
$_POST['submitted']["my_field_name"]
Note: $form_state['storage'] was empty. Please remember that I'm using the dynamic select module to populate the drop down box after querying an external database.
Comment #7
quicksketch