Javascript

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.

All you Javascript crazed developers out there, this is the group for you.

Drupal is in need of some usability improvements and after a few meetings and a lot of discussion, it is now time to take advantage of our new JQuery library in Drupal.

starbow's picture

Ahah Forms v1.5 - Secure Dynamic Subforms

At the Drupal Summit, chx & eaton let me know that avoiding the FormAPI security by directly accessing $_POST was a bad idea. So I dropped the slide out of my presentation that talked about how to create dynamic subforms, and spend the last two weeks hacking like mad. I now have an approach that I believe combines convience and security. It is packaged up in Ahah Forms v1.5 as the dynamic_subform.module. It uses the same basic algorithm as drupal_get_form when #multistep is true (but is incompatible with #multistep, so don't try to use both of them).

I have a full write up at: Secure Dynamic Forms and Subforms, but here is an example of the functions in use:

Read more
victorkane's picture

How do I iterate over the jsAC objects in autocomplete?

Hi everyone.

As you can see from a cursory view of my "Practical Dojo Lesson: An autocomplete nodereference field that is dependent upon a choice made in another" (http://groups.drupal.org/node/3471), I was able to redefine autocomplete handlers (to be triggered by uri registered with menu callback), but I was not able to get rid of the "old" (created on page load, or "ready" event) handlers. I had to send the latter to the bytebucket.

Read more

Practical lesson: An autocomplete nodereference field that is dependent upon a choice made in another

(Introducing the shiny new "Dojo Practical Lesson" format)

Problem statement

If you need to do this, feel free to use this code. If you can think of ways of improving it, please join in.

So I have three content types with additional fields added through CCK.

Content type one: Company

Content type two: Contact

Content type three: Ticket

The Company content type has a nodereference field where Contacts can be filled in (multiple autocomplete field).

Read more
Veggieryan's picture

Multi-Publisher Project Proposal

</style></head><body dir="ltr"><p class="P1">Application for Summer of Code 2007:  MultiPublisher Module</p><p class="P1">   by Ryan Grace  <a href="http://www.thefractal.org/">www.thefractal.org</a> :: ryan@thefractal.org </p><p class="P2"> </p><p class="P2">Synopsis </p>
Read more
starbow's picture

Views and Ahah Forms 1.3 released

I am really excited to announce the release of the work I have been doing to create an Ajax version of Views, by modifying ahah_forms and views_ui to work together . It took weeks longer than I anticipated, and required extending ahah_form.js and tweaking maybe 20% of views_ui, but I am very happy with the result. You can check it out yourself at http://demo.starbowconsulting.com/admin/build/views. The views_ui rewrite is available in the examples directory of ahah_form v1.2 (http://drupal.org/project/ahah_forms)

Update: I have removed the need to login to the site to administer views (some people were having trouble getting in).

Update: v1.3 released: Ok, I am probably just procrastinating reviewing my notes for friday's summit talk, but I have released a much simplified views_ui.module-example. The big thing I realized is that almost everything I really need to do can be done in the theming functions. Also, I have refined the ahah_forms.js visual effects and removed the yellow fade. This allows me to drop the two interface javascript files.

Read more
dwees's picture

hook_ajax

I don't know if this is a bit of a foolish plan or not, but I was wondering about the feasibility of creating a framework for allowing modules to relatively easily create Ajax-loadable content.

Basically I envision is a module that creates a new hook (called hook_ajax) for lack of a better name. This module would also include an API for module developers to make the dynamic creation a bit easier (for instance a version of the l() function, but one that modifies the URL to point at our module's MENU_CALLBACK, perhaps with some additional information attached).

Read more
discursives-gdo's picture

Views / Tabs / Panels - Dynamic Loading

Hello DOJO!

I want to be a Drupal ninja!

I have seen so many cool sites lately! There's one functionality set that has really caught my eye. I can't figure out how to do it, though. Can someone here give a hint? I've been through all the searches I can think of on Drupal.org and this is the first time I'm really asking, so I hope I give enough information! Here's a recent question verging on this: http://drupal.org/node/115058

What I'd like to do is display a view in a tab in a panel, and have the view be created by a stored argument that is autogenerated from the node ID.

Read more
jasonwhat's picture

JS for auto-switching tabs

I've used the tabs module from the JS tools module before and interested in doing this again with a slight addition. I'd like to have tabs on the front page change automatically, as seen here http://news.aol.com/ .

I'm not sure if js tools is using jquery for the tabs, or something else, but does anyone know of a jquery tabs plugin that automtically switches? I've seen it done for image galleries with jquery, but not tabs. Has anyone tried something like this?

Read more
sime's picture

plugin compatibility with jquery.js

There was a little discussion on the webmasters mailing list, with a suggestion that nedjo was going to make a case on dev list about 3rd party, GPL, jquery plugins in contrib.

Quoting karthik:

Thus far, to the best of my knowledge, 3rd party GPL code has not been
allowed in the repository.. We have also turned down applications
based on this guideline. However, I've noticed that the jquery
_module_ [1] and the jstools [2] modules both include (or apparently
plan to, in the case of the former) 3rd party plug-ins.

Please advise ...

Read more
joshk's picture

Notes on jQuery 1.0 Compatibility Plugin && Interface Elements

As I noted before, after some sleuthing, I discovered that there is a compatibility plugin (click here for source) which is designed to allow code written for jQuery 1.0 to run under jQuery 1.1. Mainly what it does is re-implement a number of deprecated functions. I'm interested in it because I would like to use several elements from the Interface Elements library.

So far so good! I've replaced the stock jquery.js with version 1.1.1, and I am including the compatibility script afterwards. Interface Elements perform fine, and I have only found (so far) one bug with Drupal core's javascripts.

Read more
agentrickard's picture

Drag-and-drop testing: interface for jQuery

I could use some excellent JS eyes to look at the right way to implement Drag-and-Drop using jQuery/Interface.

I've released a version for the MySite module (in the current HEAD release). See http://drupal.org/node/101471#comment-203584 for what I don't like about my implementation. Three points to emphasize to this audience:

1) I'd prefer to have a universal library; not one that is specific to my module. So the jQuery module http://drupal.org/project/jquery seems the right path to me.

Read more
joshk's picture

Updating jquery.js?

UPDATE: There is a jQuery 1.0 compatibility plugin.

Has anyone else felt the need to update the jquery.js file? In seeking to implement some functions from the Interface Elements for jQuery I found that jQuery 1.0 wasn't up to the task. There are a couple functions which were added in jQuery 1.1 that it uses.

Read more
nedjo's picture

jquery module--a place for jQuery plugins and extensions

As more of us start using jQuery, we're getting the same jQuery plugin included in two, three, or more modules. Personally I've included tabs, cookie, and history in the jstools package. I've now seen the form plugin in three different modules. As well as duplicating work and code, we get swollen pageloads that load multiple copies of the same file from different locations (one for each module). And, potentially, problems if two different modules use different versions of the same plugin, and one overwrites the other.

Read more
starbow's picture

AHAH Forms Framework released as a module

Sorry if I am spamming this group. My brain has been on fire, and I am hoping to get some feedback. Has anyone had time to look over the code and see if they think my approach is sound? Anyway, I will probably settle down soon :)

I repackaged the code and released it as a official module, so no more tarballs on my website (http://drupal.org/project/ahah_forms)

Also, I have submitted a proposal for a OSCMS Summit session on this material (http://2007.oscms-summit.org/node/226)

Read more
starbow's picture

AHAH goes to the polls

In response to my AHAH tutorial on groups.drupal.org, Moshe asked if that module could be used to make the poll module dynamic (http://groups.drupal.org/node/2747#comment-7670). I said "not exactly", but it go me thinking, and that lead me to create the beginnings of an ahah framework. To test it out, I just modified poll.module to use the framework. It went pretty quick. The hardest part was step two getting the form to be dynamic with full page refreshes (and most of that time was stripping out the multiple fields-per-form code from my example).

Read more
sime's picture

Eye-drop Editor creeps to BETA

Eye-drop Editor is finally seeing some light. This is a jquery/ajaxy image editor that integrates with server-side image manipulation.

Read more
starbow's picture

Towards an AHAH framework / automatic javascript generation

I have been having some really exciting ideas about getting the formAPI to generate the bindings to the javascript. I realized that all the javascript I wrote for the tutorial module could be generalized. Then with a bit of glue code, all of the parameters needed to do the event binding could be put in a properties set on the form element. This way Drupal coders could create modules with sophisticated AHAH effects without needing to write any Javascript at all. Here is an example of a button declaration with all of the info needed to do a incremental page update:

Read more
starbow's picture

Tutorial: A dynamically expanding AJAX/AHAH Drupal form

I have spent the last couple of weeks trying to figure out how to cleanly do dynamic forms with incremental page updates. I have put together an example module which is available for download. I have also put together a tutorial that explains my technique and the issues I ran into. I am interested in hear what people think of my approach.

http://www.starbowconsulting.com/blog/tao/dynamically-expanding-ajax-aha...

Read more
alex_b's picture

Anybody working on a $,tabs integration for drupal?

We're about to use the $.tabs plug in from stilbuero on a site. I ll write a wrapper module for it - anybody up to the same task?

This is a cooking recepie on how to use $.tabs for blocks:

http://drupal.org/node/89338

Read more
starbow's picture

Getting base_host() into javascript

I trying to figure out the best way of getting base_path() into my javascript. I wrote some dynamic form updating code kinda like this:

Read more
Subscribe with RSS Syndicate content