Voting starts in March for the Drupal Association Board election.
The features in this module are now included in Webform version 4. Therefore, the Webform Conditional module is no longer required if you are using Webform 4. However, the last version of Webform Conditional will automatically convert your exiting Webform Conditional settings directly into Webform 4.
When you upgrade to Webform 4, you should download and install Webform Conditional Version 7.x-2.x. This version will only run an upgrade during the Update.php process. Once this update has run, you can disable the module. See: #1616376: Create Migration to Webform 4.x for further information.
Once you have disable Webform Conditional Version 7.x-2.x, you should delete the module as you no longer need it. Inmotion hosting has a very good article which provides instructions for uninstalling a module in Drupal 7. Granted, it is specific to Inmotion, however the instructions only varies when you get to Step 8. The articles describes how to use cPanels to delete the module directory from their system. You will need to use the appropriate tool on your system to delete the Webform_conditional directory. For example, Windows uses Windows Explorer, Mac use the File Manager, and Ubuntu uses Nautilus.
Webform version 3 allows you to make Conditional Rules but a component can only be conditional on a component that appears in a previous page of the form. The Webform Conditional enhances the Webform module by enabling you to make a component conditional on a preceding component on the same page. You do this by adding a rule that list which values will cause the field to be hidden or displayed. If a fieldset is made conditional then all of the components inside the fieldset will be hidden if the fieldset is hidden.
Mutually exclusive conditional fields are not possible as it is. However, you can make a mutually exclusive options by adding a third select before them. This select will show one and hide another element and vice versa.
This module is dependent on the Webform module.
Once the module is installed and activated, a Conditional Rules field group will appear at the bottom of each webform component's form. However, this option is only visible for fields that are placed after one of the following component types:
- Radio buttons
- Or select lists
When you expand the Conditional Rules field group at the bottom of the component form, you will see the following three fields:
This drop down box will present a list of all of the valid component types (see above) that appear before the current component. (These components may or may not be on the current page.) From this list, you will select which component will be used determine whether to show or hide this component.
This drop down menu presents you with two choices; "is one of" and "is not one of". Remember, this conditional test is based upon the one or more values of the multi-valued components (see above list). Therefore, instead of using "equal to" and "not equal to", this module uses "is one of" and "is not one of" because you can set the condition based upon multiple values of the test component. The way to read this is if the conditional value:
- is one of a or b or c or d, then this condition is true and the component will be displayed. If the condition is not true, then the component will be hidden.
- is not one of a or b or c or d, then this condition is true and the component will be displayed. If the condition is false, then the component will be hidden.
- key value = 1 and key option = Under 18
- key value = 2 and key option = 18 to 25
- key value = 3 and key option = 26 to 30
- key value = 4 and key option = 31 to 40
- key value = 5 and key option = 40 to 65
- key value = 6 and key option = over 65
It should be noted that we are testing the "safe key" or first value of the key value pair of the component you selected in the above "Component" drop down menu.
For example, lets say you have a drop down menu component called "Age Range". It will ask the user to select their age range. And based upon their age, we will ask different questions or display different text. The values in the Age Range key pair list are:
Let's say that we will ask different questions if the user is under 18, or between the ages of 18 to 40, or over 40. In this case, you would have three different conditional fields. Their three conditional rules will be:
- If the value of Age Range is one of 1, then this first component would be displayed. Otherwise it would be hidden.
- If the value of Age Range is one of 2 or 3 or 4, then the second component would be displayed. Otherwise it would be hidden.
- If the value of Age Range is one of 5 or 6, then the third component would be displayed. Otherwise it would be hidden.
Since there is no overlap in the values, only one of the three conditional components would be displayed. We could also have over lapped the fields for which we are testing. For example, we could have added a fourth conditional field that would be displayed if the user was over 65. In this case, both the third and fourth conditional fields would have been displayed for someone over the age of 65.
As stated above, the values that should be in the list is the safe key from key value pair. Do not use the readable option from the key value pair as they will not work.
Also, each value must be entered by itself on a separate line. Do not put any separator such as a comma after each value. One of the main reasons a conditional test fails is because the values were not entered correctly.
You can play with a working demonstration of this module at sixmiletech.com.
And you can watch a screen cast which demonstrates how to add a conditional field to a web form.
Creating an issue
If you need assitance with a webform condtional issue, you can create an issue in the webform conditional issue queue.
If you have a Webform that does not work because of a bug in this module it is critical that you export of an example the Webform with this problem. The instructions are in the middle of the page. Without this export, it is extremely difficult to provide assitance.