Waterloo Region Meetup: Painless JavaScript with jQuery

Tonight I gave the Waterloo Region User Group a presentation introducing jQuery and it's use within Drupal websites. Topics covered included:

  • What JavaScript is and isn't
  • How JavaScript empowers developers to transform web pages into web applications
  • Why many developers have avoided JavaScript in the past, and how jQuery addresses those issues
  • JavaScript developer tools
  • Introduction and live demos using jQuery

Drupalcon Security Followup: Automatically use SSL logins on

Today at the Advanced Security Drupalcon talk it was mentioned that supports SSL access. Using user JavaScript, it becomes possible to modify the login fields to use SSL. Here are the steps you need to ensure that logging in will use SSL automatically.

Fixing the Enter Key on AHAH Forms

Update: I've modified the suggested JavaScript code to not break #autocomplete enter presses.

The #ahah element introduced in Drupal 6 makes setting up dynamic JavaScript-driven forms much simpler than with Drupal 5. To see this in action, take a look at the Poll module. When adding more choices to a form, clicking the "Add another choice" button doesn't reload the page if JavaScript is enabled. However, there is one problem with such a form: by adding a submit button above other submit elements, it becomes the default action when pressing the enter key. Unfortunately, browsers don't have a method to specify the default submit action, and usually just use the first submit element on the form. To see this issue, try pressing the enter key inside the Title field on a Poll node. The page reloads, and the JS-disabled fallback is executed, instead of the Preview action as may be expected.

This might be behaving as intended with the Poll module, but I wanted to ensure that the enter key action was consistent with a similar feature I was adding to the Skeleton Outline module. Most JavaScript code online will recommend doing something similar to the following:

Syndicate content