I am trying to hide/show a field from the user based on a hidden field, whos value is set from the server. I have set up a conditional so that if the hidden field 'X' value is 'a', then field 'Y' will be shown.

However, field 'Y' is being shown no matter what. I have tried reversing the logic (if hidden field 'X' value is not 'a', then hide 'Y'), but that did not change anything.

After much testing, it seems as though the conditionals of Webform will not actually do anything based on the value of a type 'Hidden' field. If I create the same logic with a 'Textfield' instead, the conditional fires as expected.

Is this a bug? Am I doing something wrong? The end result I am trying to accomplish is to hide or show a field based on an input that the user cannot change themselves.

  • i think webform conditionals uses basically FAPI States API. When is a simple way of saying it just uses Jquery Event actions. Those actions are client-side and dont occur when you return stuff from server-side.
    – tenken
    May 6 '13 at 21:58

Following up on my response above, things like FAPI autocomplete_path and as your seeing webform conditional (i think) use the States API. Which is a limited version of scriptable javascript API from within Drupal7.

Drupal does ship with jQuery UI built in. And you can make direct usage of jQuery to alter/modify forms directly using drupal core components -- such as the bundle standard jquery packages that come with Drupal 7. Want a working jqueryui autocomplete example as an example -- here's 1 in Russian (Google translate works well here):


I realize your request may be a non-coding module only solution; but such modules and APIs basically have limits as you've seen. There are pieces of drupal core that exist to let you homegrow your own solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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