This tag refers to the Drupal JavaScript system used for managing events on content.

learn more… | top users | synonyms

0
votes
1answer
8 views

Jquery.on method returns undefined is not a function

My goal was to create a simple button which once clicked would hide/show a navigational menu, and change the footer's padding alternatively, I'd have used toggle if not for the latter condition. ...
-3
votes
1answer
25 views

ask me please 1 to be double, string given in [closed]

Warning: number_format() expects parameter 1 to be double, string given in /home/fan7truy/public_html/xxx/isisaldo.php on line 154 Error in line 154 this is line 154 <strong>Rp <? echo ...
2
votes
1answer
93 views

How do I get a data value after all AJAX calls are complete?

I'm modifying the content of the modal window that pops up when using Linkit module in a WYSIWYG. This modal uses AJAX so I have to use Drupal.behaviors for the first time. My code is structured ...
1
vote
2answers
98 views

Form API ajax calls reload attached JS using behaviors

I have leaflet map attached to my form, this is the container div I used: $form['general']['map'] = array( '#markup' => '<div class="map-wrapper" id="ngmap"></div>', ); Everything ...
0
votes
2answers
43 views

Drupal behaviors with non-core jquery

For various reasons I am currently working on a module with a version of jQuery and jQuery UI that is not core. In other words, scripts[]=js/jquery.js scripts[]=js/jquery-ui.js are declared in the ...
0
votes
0answers
27 views

jQuery UI tabs in behaviors.js

I want to use my theme's behaviors.js (not template.php etc) to create jQuery UI tabs. Here is an example of jQuery UI tabs where the js is $("#tabs").tabs(); My html = <div id="tabs"> ...
0
votes
1answer
183 views

Google map in jQuery UI tabs / Drupal behaviors.js

As you can see here the google map in the first jQuery ui tab loads correctly but the same map in second / third etc tabs does not load properly or loads off centre. As mentioned here the problem is ...
5
votes
1answer
323 views

Delay ajax call on textfield to allow for typing

I would like to delay ajax from firing in the same way that the autocomplete seems to work. For example, if a user it typing, the ajax will not run until 500ms has elapsed since the last keyup. I am ...
0
votes
0answers
20 views

How and where does drupal call Drupal.behaviors.password attach method?

I am experiencing a bug in my setup. The symptom is, that the translate variable in Drupal.behaviors.password in core module user/user.js populated from the passed in settings (settings.password) is ...
0
votes
1answer
30 views

Drupal.behavior unexpectedly triggered by Ajax callback

I work on a sandbox project which provides a Responsive Tabs to Accordion Panel style. Everything works fine except that once the page loaded, any Ajax callback (i.e add to cart or colorbox) seems to ...
1
vote
1answer
56 views

Dynamic arguments in an AJAX link

I have a link that uses Drupal's use-ajax CSS class to AJAX-load some node teasers. The callback for the link uses arguments to set a range in the Entity Field Query used to return the teasers: ...
0
votes
1answer
55 views

Need help with Drupal javascript behaviors

I'm a bit lost with this and could do with some help from a Drupal JS veteran. In my module I'm dynamically generating a settings form based on a CSS file, part of which provides a font select list ...
0
votes
0answers
72 views

Custom theme for form checkboxes causes AJAX behaviors to not attach

I have the following code implemented to override the theming for the checkboxes in a Drupal form. //themes neighborhood checkboxes with AJAX link wrapper function ...
-1
votes
1answer
99 views

Click event not always fireing in Drupal behaviors

I'm having a strange problem with a form. Sometimes I have to click the submit button twice to make it submit my form. It also seems to work if I click outside the form before I click submit. The form ...
-2
votes
1answer
84 views

behaviours.js syntax (Leaflet Map)

An answer is given here to a problem concerning Leaflet Maps My question: How would I adapt this code (yellow border here) to the syntax of my-theme/my-theme.behaviours.js ? I think it would ...
1
vote
1answer
298 views

How to prevent jQuery from loading during ajax callback

Using Drupal 7's implementation of jQuery and Drupal.behaviors, how can I get some of my jQuery to run only once when the page is initially loaded, and the rest to run when the page is loaded AND ...
0
votes
0answers
29 views

Drupal behaviors don't run with form submit results returned page

I have some Jquery in a Drupal Behavior js file in my theme used to reveal a comment form on clicking a 'add comment' button. visit to the page, on clicking the 'add comment' button the revealing of ...
1
vote
1answer
213 views

Behaviors/JQuery: What's the standard/convention in Drupal 7 for running Jquery code on event *OTHER* than DOM ready?

Searching online docs so far and I've found much about Drupal Behaviors running when the DOM is ready i.e. the ready JQuery function. But what about for example if I want my JQuery code to run once ...
0
votes
1answer
209 views

Drupal behavior for #datepicker onselect not working

i have a datepicker in a webform. I want to be notified when a date is selected in the datepicker. In my form template i drupal_add_js a js starting with : Drupal.behaviors.booking_form_tma = { ...
3
votes
2answers
3k views

How to trigger Drupal.attachBehaviors after successful Ajax

I have a module that updates a node via ajax when a link is clicked. The link is a toggle, it should update the node with value 1 on first click, then with value 0 on a subsequent click, etc. Like ...
6
votes
2answers
320 views

How to prevent behavior-attached functions from being attached twice?

I have a behavior that adds on to some checkboxes. (function($) { Drupal.behaviors.mymodule = { attach: function (context, settings) { $('.skip-line', context).on('change', function(){ ...
2
votes
2answers
867 views

How to add behavior-based onclick to ajax-enabled Form API button?

I have a form with a button: $form['categories_update'] = array( '#type' => 'button', '#value' => t('Load category-related properties'), '#ajax' => array( 'callback' => ...
1
vote
0answers
151 views

Rendering Contextual Links after AJAX refresh

We have written a small module that would allow teasers in views reload/refreshed when flagged from inside the contextual links. The names of the flags are 'sold', 'underoffer' and 'withdraw'. The ...
2
votes
1answer
208 views

Form loaded with ajax call not having autocomplete enabled

I have a form (loaded by obiumap function) that have a section loaded ( by function obiumap_addobj() ) with a $.ajax call from jQuery script (addobj.js) by clicking a button (addobj_btn). This new ...
0
votes
1answer
86 views

How can I make teasers refresh when they are flagged?

I have several flags like "Sold" "Withdraw" etc which appear in Contextual links. Flagged nodes are checked through node--type.tpl.php and this allows me to add text strings like "Sold" or ...
2
votes
1answer
55 views

how could I access users profile using settings parameter in drupal behaviours?

I have a behavior as follows: Drupal.behaviors.mymodule = { attach: function(context, settings){ jQuery("#edit-user-address",context).change(function(){ console.log(" user id and other ...
0
votes
2answers
254 views

custom module js loaded before the module which it depends, Drupal.behaviors

The "Drupal.behaviors" doesn't behave as "document.ready", if I use a document.ready I will have the correct map but if I do a Drupal.behaviors, there will be an error related to the openlayers ...
1
vote
1answer
489 views

Warning: Illegal offset type in drupal_add_js() (line 4184 of C:\EasyPHP-5.3.8.1\www\lfp\includes\common.inc)

I am using D7. I am getting the above error when I created a js file with the code below and then included it in the .info file. What is wrong? (function($) { Drupal.behaviors.userLoginChanges = { ...
1
vote
1answer
92 views

Drupal.behaviors get results from function

I am struggling to understand how this works and I just can not get a grasp of if it. Basically what I am trying to do is get the results from my php function and pass it into ajax to make my page ...
1
vote
1answer
242 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
567 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 ...
-1
votes
1answer
372 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 ...
2
votes
1answer
918 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
51 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
78 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. ...
1
vote
2answers
707 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
89 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
409 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
195 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
557 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
1answer
2k 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
158 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> ...
9
votes
2answers
3k 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
207 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
295 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
699 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
34 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
801 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 ...
5
votes
2answers
6k 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
586 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, ...