User login

JQuery

Make your menus understand people's angle of intent

I read years ago how Apple at the time had a much more intuitive interface because of things like interpreting anything in the direction of a submenu as headed there, rather than immediately moving focus to whatever happened to be under one's cursor (and also how putting menus at the very edge of the screen gave them infinite depth). Always was on the lookout for people applying this to the web as best practice and finally here's an article and a JQuery plugin:

Drupal 7 Advanced AJAX Tips and Tricks, presentation by Earl Miles at BADcamp2010

Slides and code:
http://www.angrydonuts.com/drupal-7-advanced-ajax-tips-and-tricks

Drupal 7 combined the existing system with one Earl wrote for CTools.

Not covering form today (#ajax). Earl doesn't like

How you build an AJAX request and what that means.

How do you respond to an AJAX request: server-side, PHP code. 'delivery callback'

Check for duplicate titles of a node with AJAX to warn immediately before entering more data or submitting

Attached is a custom module that piggybacks on Unique Field and steals most of its other code from username_checkUsername Check.

Commit message: "Working Unique Field AJAX enhancement for node titles. Pretty sweet. It doesn't take away the duplicate warning when you change the title to not be duplicate, but it does change to a green checkmark (courtesy of the username_check module from which I also stole most of the code)."

Below, tales from

Combining first and last name form fields to make a suggested preferred display name with JQuery

Names are one the annoyances of the web development world. We want to have everything be neat, to have our brilliant content management system (Drupal) take the raw data (a site participant's name) and display it as it makes sense in different contexts.

Sometimes it comes down to asking people what they prefer to be called.

Using jQuery to auto select text in a field

So you've custom themed a search bar into your brand spanking new custom theme using my handy tutorial covering that topic (http://www.agaricdesign.com/note/theme-search-form-drupal-6)

Load new content via AJAX and change the URL

Agaric wanted to know how to have a photo album where pictures would load when selected, without re-loading the rest of the page. The goal is to have the chosen picture load (with JQuery effects and any other coolness without a full page refresh) but to also have the URL in the address bar updates so people have a unique link back to the image.

Facebook does this, and the next time I was catching up on my friends' new album additions at 4 a.m. on a Sunday morning, I had to view source and see what was going on.

What looks like the key javascript code is copied below.

For usability, Drupal should focus on the first relevant form field

For a basic, but nice, usability improvement Drupal, for all pages where a form is the center of attention, the first form field that people should type in should have the keyboard focus given to it.

Here's a method for doing it with JQuery: http://www.gerd-riesselmann.net/development/focus-first-form-field-with-jquery

Syndicate content