I have 3 Webforms named A, AA and AB, In form A there are few question with Yes and No options.

I am looking for a way to direct user depending on the selected options, If user select all the options as Yes and press submit the form should direct the user to form AA else to form AB.

Is there any easy way/Module to check the Form A and direct user to either AA or AB depending on the selected options

I assume rules could be a choice, but i can't figure out.

  • Correct me if I'm wrong, but in Multistep Form created with Webform module, wasn't empty pages simply skipped? And wasn't you able to make fields dependant on fields from earlier page, to be hidden if previous choice made them not needed? With right module you don't even need multiple pages, but that's pretty much outside of the scope of your question.
    – Mołot
    Commented Dec 4, 2014 at 17:00
  • @Mołot Thank you very much for the help, current version of Webform comes with coeducation tab which could be use to provide condition both in the same page and in other page. I am not sure why would someone use right module.
    – Yama
    Commented Dec 8, 2014 at 15:14
  • My case, In order to complete the survey user need to meet our requirements. therefore i have would like to have a page with 10 question and if they answer yes to all the questions then only they should access the survey. if the user doesn't meet our requirements then I want to display a message once user click submit because I want to save the user respond and find out which question was answered as No
    – Yama
    Commented Dec 8, 2014 at 15:29

2 Answers 2


Finally I Manage to redirect user to anther form base on entered values.

  1. Install Rules module and Webform Rules
  2. Create new rule
  3. From React on event select After a submission draft has been submitted
  4. Add a new condition, select Webform has name, Select form_id from Data selector, and select the form name from Weforms value

  5. Add a new condition select Execute custom PHP code

  6. Add the custom code

    if ($data['components']['1_are_you_aged_18_to_50_years_of_age_']['value'][0]=='Yes') { return TRUE; } else { return FALSE; }

Change the field name 1_are_you_aged_18_to_50_years_of_age_' and Yes value to your own field name and value 7. Add an action, select Page redirect and add the URL.

  1. Click save, And click save again.

  2. Go to /people/permissions

  3. Allow all the user type to Execute PHP code "Please note allowing users to execute PHP code is not recommended due to security risk".

  • I can't believe that webform rules doesn't allow you to select webform components in the data selector and the only way to get it to work is to enable the dangerous PHP filter.
    – nexus_6
    Commented Jun 4, 2015 at 15:47
  • @nexus_6 There is anther module drupal.org/project/webform_rules which extend the functionality of rules but not sure how much it help.
    – Yama
    Commented Jun 5, 2015 at 19:05
  • that's the module I'm talking about. It doesn't make it easy to compare the values of form components with the rules data selector: you have to do it in PHP.
    – nexus_6
    Commented Jun 8, 2015 at 8:33
  • Thanks, it worked. I only had to change After a submission draft has been submitted to After a webform has been submitted. For the PHP code, a simpler version would be return $data['components']['1_are_you_aged_18_to_50_years_of_age_']['value'][0]=='Yes'; Commented Mar 22, 2017 at 14:53

Yama gets close, but, instead of using custom PHP in your rule, try this patch to the webform_rules module that exposes form data that's been submitted directly to the rules UI, without requiring you to write custom PHP code.

More importantly, step 10 in the answer from Yama creates a potentially serious security problem on your site. They aren't kidding when they say "Please note allowing users to execute PHP code is not recommended due to security risk". It is a permission that should never be granted to anonymous or untrusted users.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.