4

I have put together a webform for signing in guests to a Nightshelter. Some guests are banned from time to time, and when a known guest tries to get signed in I want to show if he/she is subject to a ban. Simple enough, but I can't figure out how to do this without exposing the yes/no banned field as updateable. I can use conditionals but still end up showing the field as updateable. Is it possible to show a field as read only in a webform? Or any other suggestions?

4

You could use webform conditional rules to display or hide a message based on the ban.

  1. Add the "is banned" custom field to your webform
  2. Update it from the webform tab to be type "hidden" (but not secure value)
  3. Create a "Markup" field, and enter your warning message
  4. Add a conditional rule to show/hide the markup based on the "is banned" value.
  • I hadn't realised that I could hide a field in the webform - learning a lot here! Thanks. – Andy Clark Oct 26 '15 at 22:21
  • I set up the 'banned' field as an (alphanumeric) radio button and before I made it hidden I tested it and it worked fine using conditionals. When I made the field hidden in webform it stopped working - as though the values become inaccessible. So this doesn't seem to work - guess I should untick it as a solution - unless I'm missing something? – Andy Clark Oct 27 '15 at 9:37
  • Oof, I guess webforms won't use hidden fields as conditional control fields? That sounds like a bug to me. – Coleman Oct 27 '15 at 18:20
  • 1
    Done, I raised a bug with the webform project - see drupal.org/node/2606598 – Andy Clark Nov 2 '15 at 18:39
  • 1
    I've reopened the issue - also note that I discovered a workaround which may suit your needs. – Coleman Nov 16 '15 at 15:09
2

For select option components in a Webform, Disabled is not an option.

For something like what you are trying to do, I might be inclined to add a contextual block view that boldly states that they are not allowed in.

I also might try to set up a rule that checks that field and prints out a warning.

  • Thanks - in Civi I added a 'ban reason' and exposed that as a disabled textfield, with a conditional message if this field is non blank. – Andy Clark Oct 25 '15 at 18:30

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.