? .cvsignore
? css/.svn
? images/.svn
? includes/.svn
? js/.svn
Index: webform_alt_ui.js
===================================================================
RCS file: /cvs/drupal/contributions/modules/webform_alt_ui/webform_alt_ui.js,v
retrieving revision 1.1
diff -u -r1.1 webform_alt_ui.js
--- webform_alt_ui.js	11 Jan 2011 17:19:44 -0000	1.1
+++ webform_alt_ui.js	21 Mar 2011 07:02:38 -0000
@@ -7,6 +7,11 @@
  */
 Drupal.behaviors.webformAltUI = {
   attach: function (context) {
+    if (!$('#form-builder', context).length) {
+      // The interface is not ready yet or non-existant.
+      return;
+    }
+
     $('.check-expand', context).children().not(':first-child').hide();
     $('.check-expander', context)
       .bind('click', Drupal.behaviors.webformAltUI.toggleInputs)
@@ -19,21 +24,21 @@
     Drupal.behaviors.webformAltUI.fieldSettingsCheckboxes(context);
 
     // Because runs all behaviors on every AJAX callback unset and set clicks.
-    $('#form-builder .form-builder-links a')
+    $('#form-builder .form-builder-links a', context)
       .unbind('click')
       .bind('click', Drupal.formBuilder.editField)
       .bind('click', Drupal.behaviors.webformAltUI.showFieldSettings);
-    $('.form-builder-element')
+    $('.form-builder-element', context)
       .unbind('click')
       .bind('click', Drupal.behaviors.webformAltUI.showFieldSettings)
       .bind('click', Drupal.formBuilder.clickField);
-    $('.form-builder-element label').unbind('click');
-    $('#form-builder .form-builder-links a.delete')
+    $('.form-builder-element label', context).unbind('click');
+    $('#form-builder .form-builder-links a.delete', context)
       .unbind('click')
       .bind('click', Drupal.behaviors.webformAltUI.removeField);
 
     // Enable the scroll for the active tabs.
-    $('.horizontal-tabs-pane').bind('horizontalTabActivate', Drupal.behaviors.webformAltUI.tabActivated);
+    $('.horizontal-tabs-pane', context).bind('horizontalTabActivate', Drupal.behaviors.webformAltUI.tabActivated);
     $(window).bind('scroll', Drupal.behaviors.webformAltUI.windowScroll);
     if (!Drupal.behaviors.webformAltUI.activeTab) {
       var tab = {};
@@ -43,17 +48,17 @@
     }
 
     // Bind event handlers to update the submit button text.
-    $('input[name=submit_button]').bind('blur keyup', Drupal.behaviors.webformAltUI.submitTextChange);
+    $('input[name=submit_button]', context).bind('blur keyup', Drupal.behaviors.webformAltUI.submitTextChange);
 
     // Check to see if the form is empty and need explanatory text
     Drupal.behaviors.webformAltUI.checkForm(true);
 
     // Remove useless links from the options_element configuration
-    $('#edit-options-options-field-widget a.add').remove();
-    $('.form-options-manual').remove();
+    $('#edit-options-options-field-widget a.add', context).remove();
+    $('.form-options-manual', context).remove();
 
     // Disable dragging on the submit button
-    $('a.configure.button').closest('.form-builder-wrapper').draggable('destroy');
+    $('a.configure.button', context).closest('.form-builder-wrapper').draggable('destroy');
   },
   toggleInputs: function (event) {
     if ($(this).attr('checked')) {
