I have Webform with a radio button type field named as "preferred contact method", for selecting email or phone.

When user select the email I want to set the email field as mandatory or if user select the phone I want to set phone field as mandatory.

How to handle this in Webform Drupal 7.


2 Answers 2


That is an interesting thing to have, but i don't think Webform support such a functionality. However they are some other way to achieve the same result.

Using Webform Conditional module. you can have two sets of hidden questions, and only one set of question could be visible base on user selected choice.

If user click on phone the first set of question will be display to user where the phone is a mandatory and email optional.

If user click on email the second set of question will be display to user where you can have email as mandatory and phone as optional.

You can ready more about alternative ways here .


You can add '#states' for the field in hook_form_alter() . Check this question How to make a form required with states?

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.