Skip to main content

Questions tagged [javascript]

Use for questions about JavaScript code that is very specific to Drupal.

884 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6 votes
1 answer
1k views

How to add multiple products to cart at the same time with attributes

I have different view blocks that display multiple products on the same page, each product has their own attributes such as product bundle and custom line item, these serves as an option set / ...
Danz's user avatar
  • 439
4 votes
0 answers
349 views

Run javascript before Big Pipe

I have a page with multiple blocks loaded asynchronously by the Big Pipe module. I'd like to be able to run some javascript code (in my case, open an ajax popup) immediately after the page is loaded. ...
CamelCode's user avatar
  • 761
4 votes
0 answers
502 views

View exposed filter block no alter form with ajax

I am trying to filter out the no results items in my exposed filters. (I know i can use selective filters, but in this case i can't use them). So i alter the filters with form_alter, check which ...
mgoubert's user avatar
  • 377
4 votes
2 answers
3k views

How can I create an image gallery?

Currently I am running in D7 with the following modules: Media 7.x-2.0 Views 7.x-3.7 Colorbox 7.x-2.4 I am trying to create an image gallery using these modules with the following steps. Please ...
otc61686's user avatar
4 votes
2 answers
2k views

Adding new rows on a draggable table via jquery

I have a draggable table with preloaded "new items" - sorta like the Power Edit feature of the menu_editor module. Everything works perfect. However, I want to have a button that adds a new row via ...
Bibokid's user avatar
  • 325
4 votes
2 answers
163 views

View statistics with colorbox module

So I'm building a community website for a local photography group and I'm trying to set up a "well equiped" group photo grallery that registered members can upload photos to. The gallery should ...
Calvin Digital's user avatar
4 votes
2 answers
4k views

How to trigger a form and pass variables to $form_state with jQuery?

What is the way to trigger a Drupal form via JavaScript, and pass new values to $form_state while doing so? I have a main form, which has an element that triggers a jQuery UI dialog with a form in it. ...
Danny_Joris's user avatar
3 votes
0 answers
420 views

How to use non-minified js (e.g. jQuery) for debugging/development?

Background Drupal core contains some 3rd party javascript libraries, among them jQuery. Typically such libraries are available as un-minified and minified versions. A minified js file can have a ...
donquixote's user avatar
  • 3,652
3 votes
0 answers
130 views

Hide grey leaflet map if empty

I have a content type where the user gives a location, this is not a mandatory field. When the user don't provide location the node shows a grey map. Is there a way to remove the grey map from showing ...
Mat_Lab's user avatar
  • 51
3 votes
0 answers
2k views

8 - Firefox loads JS before CSS, causing flash of unstyled content

My Drupal 8 site will load fine in Chrome and IE, because they both load my CSS before my JS when I look at the Network tab in the console. But when on Firefox, it will load the JS before the CSS. ...
David C's user avatar
  • 221
3 votes
1 answer
544 views

How to add javascript after form was validated with ajax callback?

I created a simple form. How could I add JavaScript commands after form was validated? Why is it so hard do this? $form['submit'] = array( '#type' => 'submit', '#value' => 'submit', '#...
davide's user avatar
  • 31
3 votes
0 answers
384 views

Show slideshow without thumbnail through colorbox in Views

Within Drupal, I am loading slideshow through thumbnail. The problem with Colorbox is, that it also loads the thumbnail. I am really hoping to find the solution where clicking on thumbnail would load ...
user219492's user avatar
3 votes
0 answers
190 views

Disable form altering for admin pages on Bootstrap 3

My default theme is Bootstrap but I use Shiny theme as admin theme. Bootstrap theme alters the forms and fields. And I use Hierarchical Select module, there is a dropbox for multiselection and the ...
Metin Gül's user avatar
3 votes
0 answers
2k views

Multiple date picker for date popup widget

I've been searching for a while, but didn't find any contribute module to store multiple date values picking them from only one date popup calendar widget, just a 2009 feature request for D6. In D7 I ...
Cheope's user avatar
  • 137
3 votes
1 answer
563 views

When reimplementing Drupal.tableDrag.prototype.dropRow(), how do I access classes of would-be parent?

Using code below, I can access classes of a row that's being dropped: Drupal.tableDrag.prototype._dropRow = Drupal.tableDrag.prototype.dropRow; Drupal.tableDrag.prototype.dropRow = function(event, ...
Mołot's user avatar
  • 21.9k
3 votes
0 answers
271 views

In tabledrag form, how to prevent certain elements from having children?

I want to use tabledrag to manage 2 kinds of elements. Let's call them branches and leaves. Branch can be parent to both branches and leaves. Leaf cannot be parent to anything. A support for class ...
Mołot's user avatar
  • 21.9k
3 votes
0 answers
187 views

Filter completed events by using end time filter (greater than or equal to 'now')

I'm almost done with integrating the Fullcalendar module into my website, but I am concerned about the loading time. I have about 200 events, and getting even more which are repeated daily, weekly, ...
user12534's user avatar
3 votes
3 answers
1k views

Views UI doesn't provide links to expand fieldsets anymore

I have moved an entire drupal site to another server. While everything else seems to work fine, I can't quite access collapsed fieldsets in Views UI anymore. It looks like this All fieldsets (STYLE ...
Paul's user avatar
  • 1,213
3 votes
1 answer
3k views

Why does jQuery slideToggle revert back to initial hidden state after running?

I have a Superfish menu and a simple jquery slideToggle animation attached to each menu item. I am using Drupal 7 & the Superfish module. The idea is that on click it will show the body content ...
ricardoom's user avatar
2 votes
0 answers
46 views

Javascript library with "modulepreload"

Lately working with svelte in a project. The generated HTML uses Javascript with link and modulepreload: <!doctype html> <html> <head> ... <link rel="modulepreload&...
Koala Yeung's user avatar
2 votes
0 answers
23 views

jQuery timepicker on custom FAPI form element

How can i add jQuery timepicker to custom form element. There is some description on API docs: #date_time_callbacks: An array of optional callbacks for the time >element. Can be used to add a ...
Ev Tr's user avatar
  • 21
2 votes
1 answer
870 views

Custom Submit Callback only triggering when Form is Valid when in Dialog

I'm trying to create a node in a dialog with the following link: Enter the title of a registration form or <a class="use-ajax" data-dialog-options="{&quot;width&quot;:...
Chris Happy's user avatar
  • 1,897
2 votes
1 answer
1k views

Why is libraries-override not removing assets?

My attempt to remove CSS and JS assets is not working. I have placed the following declarations in my module's *.info.yml file. But after clearing the cache, I still see the assets in the head of ...
arnoldbird's user avatar
  • 1,237
2 votes
1 answer
3k views

How do I add a script just above the closing body tag?

How do I add a script on Drupal 8 site/app just above closing body tag? Vendor provided some JS in the following form: <script> ... code </script> Asked me to place immediately ...
user7314150's user avatar
2 votes
0 answers
399 views

Adding an Attribute to a Script Tag Before Src

I'm working with CloudFlare and have identified a script that needs the data-cfasync=“false” attribute applied so CF doesn't touch it. This script is defined in a library in a custom module. my-...
Vecta's user avatar
  • 603
2 votes
0 answers
2k views

How to use custom Javascript inside Drupal8 CKEditor

I have a Javascript for tooltips and other things which work fine in front end but I want the same Javascript to run inside CKEditor too so that the user can see what he/she will get in the front end. ...
Shuji's user avatar
  • 153
2 votes
2 answers
676 views

Get path from router and redirect after autocomplete selection

I have a form that is inflated inside a box. In that form I have an autocomplete field. I want to allow the user, when they select an item from the autocomplete's suggestions they are automatically ...
lilott8's user avatar
  • 366
2 votes
0 answers
399 views

Why does my chart created with Easychart not display a chart if number of points are more than 1000?

I installed Easychart module 7.x-3.7 in my Drupal 7.51 site. I'm using Highcharts 4.2.7 in libraries 7.x-2.3. In the example contenttype easychart_ex, I tried uploading a data.csv file with number ...
Sundar's user avatar
  • 73
2 votes
0 answers
200 views

Webform and fabric.js integration

I'm trying to design a form that allows a user to design a custom tshirt. I was thinking of using the fabric.js library to let the user design a custom image and submit it with other custom ...
Paul Morris's user avatar
2 votes
0 answers
66 views

Tips to move existing angular + cordova to drupal gap?

I have created a mobile app using cordova and angular framework which is in production already. Now I am planning to switch to DrupalGap with my existing angular application. I think support for ...
Manikandan's user avatar
2 votes
0 answers
240 views

Call form validation function by clicking link

I want to be able to click a link on my form and have it call the form's validation function (but not actually submit it!). Here's what I've got that's partially working: in form_alter: $form['...
bchastain's user avatar
2 votes
0 answers
174 views

Drupal 8.0.0 Open modal dialog

So i create new dialog: $response = new AjaxResponse(); $modal = new OpenDialogCommand($title, $content, $options); $response->addCommand($modal); return $response; can someone help me with code ...
Toni Grabic's user avatar
2 votes
0 answers
228 views

Implementing Multi Select List as a popup for Views Exposed filter (field of type taxonomy)

I am trying to implement http://demos.jquerymobile.com/1.4.5/selectmenu-custom/#popupDemo&ui-state=dialog in a Views Exposed Filter . Screenshot of Desired Implementation: http://...
harshal's user avatar
  • 4,354
2 votes
0 answers
47 views

Ajaxblocks only working for first block

I've installed the Ajaxblocks Module (see https://www.drupal.org/project/ajaxblocks). I have 2 blocks to be loaded by ajax. The AJAX request looks like this: mywebsite.com/ajaxblocks?blocks=block1/...
SoBiT's user avatar
  • 181
2 votes
0 answers
2k views

How to display the room resources in a week view of a Full Calendar

I need to show the room booking in the weekly list. I've created a node type called 'booking'. The node has three fields, start date - end date, title and room name. The room name is assigned as ...
mms's user avatar
  • 29
2 votes
0 answers
447 views

Views display tabs remember last tab(need help with adding cookies or use $_session)

hey im using Views Display Tabs to display 2 pages of view and allow the user to switch between them however the last selected tab doesnt save and i want it to do that i have tried a few things that ...
Abdel hakeem's user avatar
2 votes
0 answers
3k views

How do I write a Drupal 8 modal button

So I'm trying to open a modal via a button in Drupal 8 beta 11. I've patterned my code after some I found in BlockListBuilder.php in core, but I can't seem to get it to work. My routes are correct ...
jbhovik's user avatar
  • 51
2 votes
1 answer
227 views

Drupal alter some javascript of contrib module?

I am working on a project that implements the Drupalchat module. Everything works perfectly, but the client requests some custom changes. They want people to be unable to have private conversations ...
Guardian's user avatar
  • 568
2 votes
0 answers
52 views

Form always visible even when radiobutton value is changed (form api)

i'm having an issue with the property #states visible on a form. I want to hide it when form mercuriale's value is 1. $isMercuriale = db_query('SELECT isMercuriale FROM groupes_catalogues WHERE id = ...
Germain's user avatar
  • 170
2 votes
0 answers
532 views

Add alt attribute to a leaflet marker

I have a structure of a leaflet showing the current marker $marker = array( 'type' => 'point', 'lat' => $lat, 'lon' => $lon, ); // Add icon only if we got url (most of the ...
Hector's user avatar
  • 21
2 votes
1 answer
271 views

Why does The special menu items module break the bootstrap dropdown?

Hi Guys this is my issue on my parent menu item i am using the<nolink>shortcode to leave the link blank however in my tree i have 3 items underneath it. If i add <nolink> the menu item ...
Arrow's user avatar
  • 21
2 votes
1 answer
1k views

Add query parameter from url to all links on the page

How to Add query parameter from url to all links on the page? Basically I want to get the Query parameter from url and then attach that on all the links on the page. JQuery or PHP, Any solutions? ...
rav_amadady's user avatar
2 votes
0 answers
203 views

Drupal form #ajax callback and javascript toggleClass on radio buttons - reduced functionality

we're using drupal and I have setup an ajax callback on a form item. The form item is a radio button with two options on/off. also attached to the radio button is some js to toggle a class. The class ...
islalobo's user avatar
  • 137
2 votes
0 answers
547 views

How to access actual JS settings of my module after ajax call?

I need to add some additional JS data for my views page. I write in my module: function mymodule_views_pre_render(&$view) { if ($view->name == "myview") { $outdata=array('dataset'=>...
Sergey Kravchenko's user avatar
2 votes
0 answers
576 views

Colorbox You tube video

I am using Youtube module and colorbox. I have a content type with a youtube thumbnail in the teaser. If you click on it, I would like it to open in a colorbox with dimensions 420x315. Instead it ...
LenB's user avatar
  • 143
2 votes
0 answers
118 views

Problem with Bootstrap Theme and Jquery Multi

I was using the bootstrap theme for drupal and jquery update and everything worked ok. But by client requirements I have to use Jquery Multi instead of Jquery Update and now, this returns two errors: ...
Alberto Rodríguez Angulo's user avatar
2 votes
0 answers
133 views

How to load web form in colorbox

I have used $(document).ready(function(){$.colorbox({inline:true, href:"/node/989386"});}); on page on load but i am getting empty content, Any pointers
Jeya sankar's user avatar
2 votes
0 answers
481 views

How to properly configure jQuery for Views Slideshow/Flexslider displays in blocks

I've been playing with a slider/slide implementation for my site. But don't know how to configure jQuery properly. My research suggests that this is an issue with the implementation of a jQuery ...
nizz0k's user avatar
  • 1,172
2 votes
0 answers
105 views

Cannot target <img> tag after switching to Picture module

I have a image field that I have added an 'onload' attribute to in template.php. function mytheme_preprocess_field(&$variables) { if($variables['element']['#field_name'] == 'field_images'){ ...
T Mardi's user avatar
  • 93
2 votes
0 answers
6k views

how do I pass the session ID?

i am trying to get authenticated data after login with services module. ive a drupal services set up at openshift and the htmls are in my devices. i managed to login, get authenticated, get the ...
user3814537's user avatar

1
2 3 4 5
18