Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I am using webform heavily on a site I am building, but have hit a massive hurdle.
The site owner wants help text to appear at the end of each checkbox option.
For Example:
Option 1 [i]
Option 2 [i]
The user can then click on the '[i]' at the end of the checkbox tect to display a popup with a description of that option.
Any help greatly appreciated...
Comment | File | Size | Author |
---|---|---|---|
#5 | webform-form.tpl_.php_.txt | 6.09 KB | vernond |
Comments
Comment #1
vernond CreditAttribution: vernond commentedThat is waaaaaayyyyy outside of Webform. You're going to want to look into hook_form_alter and jquery (or just standard/basic javascripting) for that kind of thing.
Comment #2
digiRich CreditAttribution: digiRich commentedDoh!
I was hoping that wouldn't be the case.
Its at times like this I wish I hadn't built 6 pages of long checkbox webforms, and done it with plain old php from the start.
Rethink methink, but thanks.
Comment #3
vernond CreditAttribution: vernond commented:-) In my limited experience it's easier to do via the Drupal and jquery frameworks than hand-coding everything from scratch. I even managed once to get it as far the popup's appearing on mouseover rather than showing a div with a click. It can be quite effective (although, in my innocence at the time, I did it without the benefit of advanced libraries like jquery).
Take a peek at happens when you hover over the text next to the checkboxes here: http://www.redballoon.biz/mg/index.php
Comment #4
digiRich CreditAttribution: digiRich commentedThat is pretty much what I need. I just hope that this will be interated in to the next release of webform (or just more flexibility to add code).
Can you point me in the right 'hook_form_alter' direction.
Thanks for your advice...
Comment #5
vernond CreditAttribution: vernond commentedI blush as I confess that I didn't do that "the right way". I'm attaching the butchered webform-form.tpl.php (remove the .txt from filename) for you to play with as you see fit. The additional help.css file which does most of the magic you can grab from the site above.
Basically what I did was manipulate the Drupal rendered HTML as a string prior to outputting it to the client browser. There are better/cleverer ways, as I said, and I'm not entirely sure just at this minute exactly how it would work using the right hook... Good luck though!
Comment #6
digiRich CreditAttribution: digiRich commentedThanks for that. Much appreciated.
I'll let you know how I get on:)
Comment #7
DanChadwick CreditAttribution: DanChadwick commentedThere won't be further feature development in the X.x-3.x branches.