I have the webform module installed on Drupal 7.41 with CiviCRM 4.7.2. I'd like to make an event registration form. This event spans a few days. If the person filling out the form has an organization membership id, they need to be able to enter that, and membership options need to be enabled for the days they wish to attend.

For example. The event is Monday and Tuesday. There is also an "All Days" option. There will be a Member option for each day, a normal price for each day and a retire price for each day. Above the checkboxes there will be a text box where they can enter their membership ID. If that text box is empty I want to disable the membership options. Currently I can only disable to whole checkbox group.

In addition, if any of the All boxes are checked, the remaining boxes need to be disabled.

Thoughts on how I could do this? Thanks!!

2 Answers 2


You can use jQuery in the webform to hide/display the checkboxes based on the contents of the membership id box. A simple implementation could just check whether the membership box is blank, but then any random stuff would show the member options. A next step would check the membership id is of the right format. Even better would be using the API to check the validity of the id entered.

That will let you display what you want but does not prevent a determined user displaying the hidden options so you should probably add a validation rule as well.

Also, if the person filling out the form is an existing contact, you could use the auto-populate feature for existing contacts to get the webform to display the membership number directly.

  • I'm curious why this got down voted? Having access to jquery during all of this would be great! I didn't even know you could do that and I must know how to do that! Thanks! Commented Mar 7, 2016 at 13:00
  • I'd like to know too - seems bad practice to down vote without explaining why. But I can tell you it works! You can put your script in a Markup component or add it to the theme see drupal.org/node/342183 in Drupal's Site Building Guide.
    – Aidan
    Commented Mar 8, 2016 at 9:14
  • Agree - I'm voting it up! Commented May 6, 2016 at 12:24

Definitely time to use the Webform Conditionals here - I think it's in Webform but it may be a separate module. Google for a tutorial :)

  • "As of Webform version 7.x-4.0-alpha2 this module has been merged into Webform and is no longer necessary." - drupal.org/project/webform_conditional
    – Aidan
    Commented Mar 7, 2016 at 9:48
  • Webforms allows for conditionals true, but it only allows disabling the whole control which in this case is the group of checkboxes. Thanks for the reply! Commented Mar 7, 2016 at 12:59

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.