This tag refers to the Drupal JavaScript system used for managing events on content.
1
vote
1answer
17 views
How to load conditionally a script depending on whether element exists in DOM?
I have a Drupal.behaviors.leftmenusticky script that converts a left menu to a sticky menu (100% height,position fixed and the like) but I want to drupal_add_js it only if the menu actually exists in ...
1
vote
1answer
77 views
Button with Drupal Behavior jQuery Conflicting with AJAX 'Add More' Button on Unlimited Cardinality Field
I have a form with an unlimited cardinality field that creates an 'Add more' button to add more fields. I also have a separate pair of fields. One of these fields has a value prepopulated on starting ...
0
votes
0answers
26 views
Reuse Drupal behaviors
After writing a lot of duplicate js code in Drupal through the years i think its time to ask a question about this.
Imagine this simple beahvior that submits a form onChange of a select element
...
-1
votes
1answer
95 views
In a Drupal 7 block, how to enable calling a Javascript function using behaviors
I am trying to put code into a block that contains a Javascript onclick handler. Have been trying to figure out how to use drupal_add_js, but cannot figure out how to make an onclick function work. I ...
1
vote
1answer
70 views
Accessing Drupal.settings outside of attach function
I'm trying to make some of my Javascript in a Drupal 7 module a bit more modular, as I want to access a function inside Drupal.behaviors.attach() from another JS file. So first of all I need to move ...
0
votes
0answers
37 views
drupal 6 jquery module additions
this is what the module has in it now for basic toggle of the login box.
Drupal.logintoboggan_toggleboggan = function() {
$("#toboggan-login-link").click(
function () {
...
2
votes
0answers
49 views
Creating ajax forms with ajax
I have been trying to implement popup forms that load dynamically, which initially seemed pretty easy. My current method is to echo the form from a menu callback, and insert it where needed with js. ...
0
votes
2answers
202 views
jQuery ajax request breaks drupal behaviours
In the Drupal commerce checkout I want to fill in the billing information automatically. I do that by attaching a javascript to that form and retrieving the information that is stored in the line ...
0
votes
1answer
49 views
In Drupal 7, What is a good approach to copy the image from one imagefield to another imagefield?
I'd like to allow the user to upload an image once, and have it apply to 3 other image fields on the same page without requiring the user to submit the form. Afterwards I intend to apply different ...
1
vote
0answers
211 views
Attach a handler to the “event” of autocomplete select with jQuery
I'm using Views Autocomplete Filters on an exposed node title field. I would like to attach a handler to the "event" when the user selects one element from the autocomplete list without applying this ...
3
votes
1answer
117 views
Is there advantage to using Drupal.settings, as opposed to directly passing json-encoded var to javascript function
Inside my custom views template, views-view-myview.tpl.php, I have a variable ("$myvar"), which I need to pass to a custom javascript function. Here is how I am currently doing it:
A. json-encode ...
7
votes
1answer
341 views
Correct AJAX practices
I have got content types called 'Online Discussion', henceforth referred to as OD and a content type called 'Online Discussion Reply', henceforth referred to as ODR. Having Entity References ...
0
votes
0answers
1k views
Ajax via Jquery and attach behaviors
The Ajax framework is very nice but i want more complex effects. So I am trying to do the Ajax calls via Jquery. The goal here is to load nodes by clicking some links on the menu but the nodes ...
0
votes
2answers
119 views
How to group li element via using Drupal.behaviors?
A newbie question here.
How can I select a range of li so I can moved them inside new element?
For example:
<ul>
<li>test</li>
<li>test</li>
...
5
votes
1answer
1k views
Drupal's attach behaviours : react on all newly loaded content?
I've got two different modules which in many ways work together. One of the things they work together on is that module A loads content via AJAX, and module B needs to attach event listeners to the ...
0
votes
2answers
121 views
Why JS doesn't work on a saved page?
I've tried to save /admin/structure/block page and open it with Firefox 14.0.1. After this I cannot drag blocks. Why is that? There are no errors in the console. How should I debug such behavior? I ...
1
vote
0answers
191 views
Using ajaxcomplete in D7 to parse links
I am using two themes, one which is Mobile jQuery based that is presented to any mobile user. Also, I am using a jQuery lightbox module that is enabled for visitors on the desktop site to view a ...
1
vote
1answer
349 views
How to re-run javascript core code for content loaded with jQuery's ajax()?
I'm trying to AJAXify page loads using .load()/.get() methods and the main problem I'm currently stuck with is that the loaded content isn't being processed by the relevant javascript code.
I've ...
1
vote
0answers
20 views
Passing JS settings local to an instance of a field
When attaching a behavior to an object there are two parameters, context and settings. As I understand, settings object is global to all the page. But what to do if I need to send different settings ...
4
votes
2answers
415 views
How to properly specify context for Drupal behaviours
I have this code that does not work. I know why it does not work - first time page is loaded 'context' is all page and jquery easely finds '.view-SPECIFICVIEW .view-content'. After AJAX 'context' has ...
2
votes
1answer
2k views
Listen to AJAX complete event from a behavior
I have a form that has an AJAX button. When I click it, it updates a bunch of stuff as expected which is fine.
I was wondering if there is a way to create a listener in behavior that gets called ...
0
votes
1answer
349 views
in drupal 7, need a simple module example for ajax, json and drupal.behavior for jquery ? [closed]
I have been looking for a example of module that builds a hook_menu that outputs json, and there is a jquery file that works in drupal.behavior.
could someone recommend me a example if you have it, ...
0
votes
1answer
90 views
Is it possible to add a second `drupal.behaviors` to your module?
I have a module that uses a bit of jQuery.
But when I submit a form I want it to call an other bit of jQuery on the landing page.
So I thought adding another Drupal.behaviors to my module.
But this ...
1
vote
1answer
192 views
Drupal behaviour function not getting executed
I defined a simple block on my module, using the following code.
function visita_virtual_block_view($delta = '') {
switch ($delta) {
case 'mapa':
$path = ...
0
votes
1answer
543 views
How can I dynamically add drupal behaviors to a form from php using ajax?
I am creating a form which dynamically changes based on the value of a select element. What happens is this:
The user selects a value from the select element
The select element uses Drupal's ajax ...
2
votes
1answer
189 views
Custom actions kicktart commerce cart
Hi I've been struggling with this issue for a while, look for it from google to the official Drupal Commerce documentation without any luck. So i have a cart and I am customizing the looking and the ...
2
votes
2answers
348 views
I added a new module and it breaks Javascript from my theme. How can I fix? (Drupal 6)
I have recently installed a new module, "Views Nivo Slider", and it is breaking the javascript on my web site that I have added via my theme. I'm at a loss as to what I should do to fix the issue.
...
2
votes
1answer
847 views
Drupal 7 Ajax to Load & Interact with one Nodes Comments from its Related Node
I am having some trouble in my quest to build a Drupal 7 custom node based image gallery module. I've got it working, but now I need AJAX to load and manipulate comments.
What I am doing
I've ...
3
votes
3answers
139 views
General architectural approach to Drupal for a project
Apologies for the inspecific title, but my question is a relatively generic one!
I'm relatively new to Drupal, and because I've historically had a very different approach to CMS implementation, I ...
6
votes
1answer
2k views
How to use Drupal.behaviors?
I am trying to do a simple ajax request when the document is ready. Along with that, I also want to provide a function that is an onclick event.
Here is my code:
(function ($) {
...
2
votes
1answer
606 views
First AJAX request is working very well, next takes too much time
I'm working on ajaxing my site, for a long time now.
I found a method that's working for me, but only the first AJAX request is working the right way; the next request takes at least twice the time.
...
1
vote
0answers
358 views
Figure out the difference between loaded JS, CSS files, and files needed to be loaded for new content
I'm looking for a way to figure out what CSS and JavaScript files are loaded, and what else CSS and JavaScript files needed to be loaded for new content I'm injecting with AJAX.
I've am module file, ...
4
votes
2answers
6k views
Force Drupal to attach Drupal behavior to new ajaxed content [only Drupal.attachBehaviors() is not working the right way]
I was doing lot of posts on drupal.org about this topic, but unfortunately in the wrong context.
Ajaxed content is not attaching needed JS and CSS (forum)
Ajaxed content is not attaching needed JS ...
4
votes
3answers
2k views
How can I control the order of Drupal.behaviors?
I want the JavaScript code from module X to run only after the one from module Y has run. Whats the best way to do this?
