Problem/Motivation

The JavaScript in this code does not detect buttons that have been converted to use the HTML5 <button> markup. This effectively "breaks" the module on themes that support/enforce modern markup.

Proposed resolution

Change jQuery selectors to use the :input selector.

Remaining tasks

None

User interface changes

None

API changes

None

Original report by yenidem from #2219965-11: Add #icon and #icon_position to variables and stop altering values of elements

I use Hierarchical Select module with bootstrap, there is a dropbox for multiselection and the code of submit button for adding terms below;

If I use bootstrap despite I use another admin/node edit theme the submit button code showing as below and it does not work like this;

Add

I applied the patch#8 but it did not work for me,
please advice.

Comments

markhalliwell’s picture

Status: Active » Needs review
StatusFileSize
new4.67 KB
markhalliwell’s picture

Issue summary: View changes
markhalliwell’s picture

Title: Decrease JS specificity to allow HTML5 "button" elements » Decrease JS specificity to allow "button" elements

Not specific to HTML5, just copied title.

yenidem’s picture

Hello Mark,
Thank you for your support and your help.

Unfortunately the patch above did not work. My admin theme is Shiny, and I also use admin theme when editing/creating nodes. Shiny theme is not bootstrap but my default theme is bootstrap sub-theme.

Actually I do not understand why the bootstrap theme altering form elements of Shiny theme, if is there any possibility to stop altering admin theme the problem will solve temporary.

After applied subjected patch the submit button code did not altered until selected any parent term, when I change parent term the submit button code altered.

Thank you again.

yenidem’s picture

I solved the problem as barbaric, I added function below;

function subthemename_button($variables) {
$path = $_SERVER['REQUEST_URI'];
$find = 'ajax';
$pos = strpos($path, $find);
if ($pos == true) {
  return '<input' . drupal_attributes($variables['element']['#attributes']) . '>' . $variables['element']['#value'] . "\n";
} else {
  return '<button' . drupal_attributes($variables['element']['#attributes']) . '>' . $variables['element']['#value'] . "</button>\n";
}
}

above code works but it is not healthy..

markhalliwell’s picture

Again. Some module (I thought this one, from your message) is targeting <input> buttons specifically. I'm surprised the above patch didn't work for you. Regardless, I agree, the "solution" in #5 isn't really a solution at all... it's just a hack.

yenidem’s picture

Yes, the submit button does not work if own code is . I applied the patch#1 to on different sites and both of them did not work. When you choose any option from select list the Submit button changing to element from . The admin and node editing theme is not bootstrap but ajax queries altering button based on default theme. I really need Bootstrap and Hierarchical Select module so I have to use solution#5 until find better solution :/

vitalie’s picture

StatusFileSize
new912 bytes

I have same problem as in #7, patch #1 does not help. I discovered that the problem lies in the fact that addOpString is not set correctly (see attachBindings functions in the js file). Here is a patch that worked for me. (It works for me in both Bootstrap and Bartik themes). I attach the patch (I hope I've named it correctly).

yenidem’s picture

@vitalie,
the patch #8 worked, despite the input element altered the patch works. I'll test and review and inform you if there is a bug.

thank you.

erilot’s picture

The code change in #8 worked here as well. I haven't studied the code at all, so I don't know how clean it is or whether it plays by the rules... but it does allow the dropbox to work when using bootstrap.

I'll continue to test here, but so far so good.

sylus’s picture

Status: Needs review » Reviewed & tested by the community

Patched in #8 worked greatly for me for bootstrap + hs module.

stefan.r’s picture

Status: Reviewed & tested by the community » Closed (fixed)

Committed, thanks!

stefan.r’s picture

Status: Closed (fixed) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.