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.
Hello,
If i enable the seven theme, and if i add form elements of button type, i see the options with a button design.
But, if I choose the bootstrap theme for my site, options elements are converted to radio buttons. The html output seems to be modified, i don't see any .btn-group class on the parent wrapper and no .btn class on each option.
How can I get the bootstrap style for my options?
Thanks !
Comment | File | Size | Author |
---|---|---|---|
#10 | styles_of_buttons_is-2908642-10.patch | 762 bytes | jrockowitz |
| |||
#5 | drupal-webform-options-button-seven-theme.jpg | 96.12 KB | kumkum29 |
#4 | drupal-webform-options-button-bootstrap-theme.jpg | 96.24 KB | kumkum29 |
Comments
Comment #2
kumkum29 CreditAttribution: kumkum29 commentedComment #3
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedBootstrap support is an ongoing process. Make sure to enable the webform_bootstrap.module which is starting to address certain compatibility issues.
Please post some screenshots and code snippets that help better define this issue.
Comment #4
kumkum29 CreditAttribution: kumkum29 commentedHello jrockowitz,
The submodule webform_bootstrap is enabled. But, I see no changes.
I post 2 screenshots : 1 view of the webform with the Seven theme, and 1 view with the Bootstrap theme.
We can see that options elements haven't the same "design".
I have verified the code source, and the output html is different:
With the bootstrap theme we get a parent wrapper with .form-item class. This parent wrapper don't exists with the seven theme. The generated html code for this webform element haven't the same structure...
Should I create a custom module or use a hook to alter the html of this element ?
Thanks for your help.
Comment #5
kumkum29 CreditAttribution: kumkum29 commentedComment #6
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedYes, the 'Buttons' element is clearly not working when I enable the Bootstrap theme and Webform Bootstrap module.
The main problem is the Webform module is using jQueryUI to create the Buttons widget.
There are two options...
Update js/webform.element.buttons.js to properly handle Bootstrap's markup and continue use jQueryUI styled buttons.
- or -
Override js/webform.element.buttons.js and use Bootstrap to generate Bootstrap styles buttons. @see https://getbootstrap.com/docs/3.3/javascript/#buttons-checkbox-radio
Ideally, any Webform library (JS/CSS) that has a Bootstrap equivalent should be overridden and use Bootstrap's CSS and JS.
@kumkum29 I would be great if you can contribute your solution as a patch and/or a recipe.
Comment #7
kumkum29 CreditAttribution: kumkum29 commented@jrockowitz
I analyze these 2 methods and try to find a solution to solve this problem...
Comment #8
kumkum29 CreditAttribution: kumkum29 commented@jrockowitz
With a rapid modification in the js/webform.element.buttons.js file, I get options with a "button" style (and with the bootstrap theme):
We must optimize this hack for all the possibilities.
Comment #9
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedI am fine with just fixing the JS.
Can you please create a patch can be reviewed?
Comment #10
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedAttached patch adds a Bootstrap specific selector.
Comment #12
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedI committed the patch. Please download the latest dev release to review.
Comment #13
kumkum29 CreditAttribution: kumkum29 commentedHello jrockowitz,
thanks for this patch (sorry but I did not have time to make the patch).
For options, I get the style "button" with the bootstrap theme.
Thanks !