--- C:\Users\tcw6452\Desktop\ahah_helper.js Fri Aug 29 14:58:21 2008 +++ C:\Users\tcw6452\Desktop\ahah_helper.js Wed Jan 21 13:33:04 2009 @@ -1,5 +1,14 @@ // $Id: ahah_helper.js,v 1.1 2008/08/29 18:58:21 wimleers Exp $ +selectedForm = null; +selectedInput = null; +$(document).ready(function() { + $('input, textarea, select').focus(function() { + selectedForm = ""+this.form.id; + selectedInput = ""+this.name; + }); +}); + (function($) { if (Drupal.jsEnabled) { @@ -69,9 +78,17 @@ // added to the page, this if statement allows #ahah[wrapper] to be optional. if (new_content.parents('html').length > 0) { Drupal.attachBehaviors(new_content); + + //Add event handler to new form elements. + $('input, textarea, select').focus(function() { + selectedForm = ""+this.form.id; + selectedInput = ""+this.name; + }); } Drupal.unfreezeHeight(); + //Timeout is to allow IE time to regenerate the DOM + setTimeout ("document.forms[selectedForm][selectedInput].focus()", 1); }; }