JavaScript is a prototype-based object-oriented scripting language that is dynamic, weakly typed and has first-class functions.

learn more… | top users | synonyms

0
votes
1answer
14 views

Drupal and Require.js not playing nice - double load of jQuery

I’ve been given a design library from a large cooperate client built utilizing Bootstrap 3 and Require.js. It’s very robust and well-built with the various scripts using Require.js to load jQuery. ...
0
votes
1answer
15 views

Where to write a jquery script for a registration form page which created using webform module in Drupal 7?

I have created a registration form page using the webform module. The registration form page contains personal info and billing info groups with fisrtname, lastname, email, age fields and a check box ...
0
votes
1answer
51 views

Capitalize each word's first letter while entering node with javascript [on hold]

I want to capitalize the first character of each word while entering node titles (and some other fields) with JavaScript. For example: First node title -> First Node Title second NODE tiTLe -> ...
1
vote
1answer
24 views

Drupal JS add noscript after every <script> tag

I'm looking for a way to add the noscript tag after every tag. Even the file tags. I cannot have alternatives as the client I'm doing this for has made this mandatory for 508 purposes. I believe the ...
0
votes
0answers
24 views

How to call a JavaScript function inside the form_submit?

My problem is exactly as the title of my post shows. How should I call a javascript function inside the form_submit hook? I just need to call a function which is previously defined in a javascript ...
0
votes
0answers
28 views

Is there a way to retrieve DRUPAL TWIG template's with core drupal 8 javascript functions like twig.js?

Is there a way to get precompiled twig templates from drupal 8 ? Example : Drupal.getTemplate('my-template.twig')(data); Thanks.
0
votes
1answer
18 views

Javascript link in theme.info not working Drupal 7 [closed]

Why is my jquery.js file not found when I use this code in my theme.info? Im using drupal 7. scripts[] = js/jquery.js I got this code from the drupal page and I'm 100% sure its the right path. ...
0
votes
0answers
21 views

Apply “autoInside” setting

I'm using Drupal Commerce Kickstart's Cloud Zoom and it does not seem to have a UI setting to control zoom position on large and small screens. On larger screens, the zoom position should be right of ...
0
votes
1answer
27 views

Use drupal.settings variables on javascript

I think this is a silly question, but I can't seem to find the "right" keyword to use in searching the forums. Anyway I'm using the google maps API on my website regarding restaurants. The map loads ...
0
votes
1answer
25 views

How to add special character validation on specific field in form registration process

I want to add a special character validation on a specfic field. Here I have my code but it does not work and there is no error. function mymodule_form_alter(&$form, &$form_state, ...
0
votes
1answer
60 views

Have Leaflet marker popup open on page load

Has anyone used Leaflet to display a single location, while making the "popup" open when the map is loaded? This is really easy to do in Leaflet, but the module's JS is a little hard to decipher. ...
0
votes
1answer
13 views

Question about Managing JavaScript in Drupal 7

If you go to https://www.drupal.org/node/756722#behaviors at Behaviors section you will see: (function ($) { Drupal.behaviors.exampleModule = { attach: function (context, settings) { ...
2
votes
1answer
44 views

Add a small javascript/HTML to a page

So I have a small bit of HTML and Javascript that I want to embed in a basic page. I go to edit the page, turn off rich text editing, and paste the HTML/javascript. I save, and then the javascript ...
-1
votes
1answer
20 views

I have Created a form to upload images, where i should display error message if i upload more than 3 images and should disable submit button

I have Created a form to upload images, where i should display error message if i upload more than 3 images and should disable submit button to delete already uploaded image if i want to upload more ...
1
vote
1answer
23 views

D7 - Syntax of js custom file added directly to theme

Alright, so I've read the documentation of JS framework in Drupal and there is a simple example how the syntax of JS file should look: Drupal.behaviors.myModuleBehavior = { attach: function ...
-2
votes
0answers
33 views

while a gmap block using views and printing it on node.tpl.php gives error

while a gmap block using views and printing it on node.tpl.php gives error Uncaught Type Error: Cannot read property '__e3_' of undefined. But when I place this block in a region and then ...
0
votes
0answers
14 views

hook_form_alter logic only on certain buttons

I have an existing webform that I'm using hook_form_alter to prepopulate various fields on. It "worked" before I just added a new field. I just added a new Upload File field (a Managed file I believe ...
0
votes
1answer
54 views

Drupalgap exposed filter for data and select field

I spent all weekend trying to make this work, and couldn't figure it out. How do I create a views exposed filter for date and a text list on a given node? My setup - I have a view that is exposed as ...
0
votes
2answers
40 views

How to block users to accessing Drupal website if javascript is not enabled?

I checked many pages in Drupal Answers, which didn't have the answer of the following question: Consider a case that I need javascript to be enabled for visual effects in drupal design. How can I ...
2
votes
2answers
42 views

How to make a reset form button without type 'markup'?

My situation: I built a form with FAPI. I display the results in a table like this: function grap_contact_repository_form_submit($form, &$form_state) { ... $form_state['results_table'] = ...
3
votes
2answers
112 views

Why do I need to use .live() in Drupal Behaviors?

I am trying to be a good boy and use Drupal Behaviors to manage my JavaScript. My understanding is that one of the advantages of using Behaviors is that it frees you from having to use .live() to bind ...
5
votes
1answer
149 views

How does CSS and JS aggregration work in Drupal?

When Drupal is set to optimize JS and CSS, it creates the 'js' and 'css' folders in your public file system root. Aggregated JS and CSS get stored in these directories. I've tried to figure out how ...
0
votes
1answer
30 views

How to add Javascript in Drupal 7 with jQuery?

I am trying to provide the option that users be able to put comment under each paragraph. So at the end of the article, I have something like this: Comments for paragraph 1 /* here I show the ...
0
votes
1answer
19 views

Creating item library, allowing user to make selections and publish to another page [on hold]

Above is a rough MS paint concept I banged out to illustrate what I'm trying to do. I need to create a library of items, which have pictures, descriptions, names, etc. This library will be ...
0
votes
1answer
34 views

behaviors javascript executing

I want to pass params via Drupal to my JS file. I have no problem fetching them with the code below, the problem is that as the $(document).bind('leaflet.map' function executes FIRST, it is not able ...
1
vote
2answers
50 views

D8: How to perform ajax call in javascript

I'm trying to perform an ajax call from a javascfript file by executing this: $.ajax({ url: '/lunapark/ajax/space-invaders/' + score, success: function ...
1
vote
1answer
32 views

How to use photoswipe script in Drupal 7

I want to use photoswipe script on my site to preview images. I downloaded the script, copied two JS files code-photoswipe-1.0.11.min.js and simple-inheritance.min.js. Include them in a file ...
0
votes
2answers
31 views

How can I add “x-tmpl” script tags to the page for use by Backbone/Mustache?

I'm building a D7 site that uses Backbone to parse JSON data (from Views JSON), and then feeds it to a series of Mustache templates for rendering with Javascript. I want to keep the Mustache ...
1
vote
1answer
51 views

advagg drupal module breaking my js file

I am using advagg module to improve my website performance and I also using date picker jquery UI function for date functionality. I have datePicker intialization $( "#datepicker" ).datepicker(); . ...
0
votes
1answer
41 views

How can I include a custom JavaScript file such that it can access and bind events to DOM elements?

This is my first time writing custom JavaScript for Drupal, and at the moment I am attempting to bind onClick events to buttons within a block generated by a view, but I suspect I am approaching this ...
0
votes
1answer
27 views

Perform action on logout,

I would like to add javascript on logout. I tried using hook_user_logout but the javascript doesn't get added. Even adding something as simple as drupal_set_message doesn't result in a message ...
0
votes
1answer
39 views

Submit few forms in Drupal 7

I try to add Poll-voting to my website, on page I addet 5 votings forms, I try to make submission of all 5 forms by one click instead of 5 clicking. I wrote this script : <script ...
0
votes
0answers
17 views

ckeditor interface language for multilingual site

I am trying to implement various languages in ckeditor interface for my multilingual site if i set config.language = 'en-gb'; config.wsc_lang = 'en_GB'; config.scayt_sLang = 'en_GB'; in admin panel ...
0
votes
0answers
10 views

when i onclick radio button then it's value should display in textfield [duplicate]

here i have two radio buttons radio button "One" and radio button "Two", when i click/check on radio button "One" then then it's value should display in textfield of "Display". ...
0
votes
1answer
75 views

when i onclick radio button then it's value should display in textfield

above is the sample screenshot of my form where i would like to do is: when i click/check on radio button "One" then then it's value should display in textfield of "Display". Code: function ...
1
vote
2answers
44 views

Update Two select box when change another select box

I have drupal form with three select box i want to change select box 2nd and 3rd after change value of 1st select box. ex: i have Three select box 1) Cruise line 2) Destination 3) Ship Id When ...
0
votes
0answers
34 views

Show content of custom password field on mouseover

I need to hide a custom password field content and display it when a user needs to see and copy it. Using Password Field module is one way to go. But then Password Toggle module doesn't seem to ...
-1
votes
1answer
37 views

on-page javascript not interpreting query string

I've got a question today about on page javascript that writes then is supposed to read a query string. I'm working with a third party tv station finder that has provided me with a snippet to drop ...
0
votes
1answer
40 views

How to make sure my behavior is triggered before AJAX?

I have a form elements that looks like this: $form['properties'][$property->idProperty] = array( '#title' => $property->Label, '#ajax' => array( 'callback' => ...
2
votes
1answer
96 views

Internal/External JS don't work with Drupal, but works fine in static HTML/JSFiddle

Continued from here Applied JS to Drupal theme doesn't work correctly, but it works fine outside Drupal Working JSFiddle: http://jsfiddle.net/tbq8eo8b/10/ (it calculates total, in Drupal it ...
0
votes
1answer
29 views

Applied JS to Drupal theme doesn't work correctly, but it works fine outside Drupal

Applied this JS http://jsfiddle.net/tbq8eo8b/10/ to webforms. As you can see in fiddle, it calculates total amount. When in Drupal, it gives 0 no matter what amounts you select, it always prints 0. ...
1
vote
1answer
89 views

How to pass node ID argument to Drupal 7 div auto update ajax script

EDIT: There seems to be a ready-to-use http://drupal.org/project/block_refresh module available as @albertski indicated, so no need to struggle to develop a new module. I've implemented the code on ...
0
votes
0answers
29 views

JS: Handling click event on element created by another module's JS

I've got two modules, one of which handles a button which makes all menus retract from sight, and another which handles a cycling background gallery. I'd like to switch from a "blurred" to a regular ...
0
votes
1answer
14 views

How do I find out what added code to the $closure of my theme?

I have code in the $closure variable of my theme and I don't know what added it to the theme.
0
votes
1answer
30 views

Why Cant add a class to an element by jquery [closed]

In the page.tpl.php I have some elements like <div class="play"></div> I have linked js file to the page and it is correctly works since all functions operate based on click ...
0
votes
0answers
34 views

fivestar module js breaking my custom js

My problem is when I use five star module on any page my js gets break on that particular page. I don't know what I am doing wrong
3
votes
1answer
206 views

Using Grunt.js with Drupal [closed]

I'm in need of an organization system for my JavaScript code Drupal. Currently, I've got it inside a folder in my theme's directory: "sites/all/themes/mytheme/js". I've looked at using Grunt.js, and ...
0
votes
2answers
804 views

Want to show/hide multiple divs based on dropdown box selection

I've tried looking around and there are similar problems, but mine is way more simple, but yet, I can't find a solution within these forums. This is the dropdown markup. <select id ...
1
vote
2answers
33 views

Javascript works inline in webform but not as standalone

I have a javascript that works if I place it in a mark up in my webform but breaks the form if I make the form a multipage. If I place the script as it's own file and then call it using ...
0
votes
2answers
199 views

javascript does not work after form load through ajax [closed]

I am using field collection module for showing some fields with add more option using ajax built in functionality of field collections. in my field collection I have added some javascript on some of ...