r13339 - MoreFieldsAndWidgets/archetypes.referencebrowserwidget/trunk/src/archetypes/referencebrowserwidget/skins/referencebrowser

"Thomas Desvenain" <[email protected]>
Newsgroups gmane.comp.web.zope.plone.archetypes.cvs
Message-ID <[email protected]>
Author: thomasdesvenain
Date: Wed Dec  8 01:07:02 2010
New Revision: 13339

Modified:
   MoreFieldsAndWidgets/archetypes.referencebrowserwidget/trunk/src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.js
Log:
fixed critical bug when it tried to get container : 
container id is not modified by ref_browser_ prefix, so we get back field id from it

Modified: MoreFieldsAndWidgets/archetypes.referencebrowserwidget/trunk/src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.js
==============================================================================
--- MoreFieldsAndWidgets/archetypes.referencebrowserwidget/trunk/src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.js	(original)
+++ MoreFieldsAndWidgets/archetypes.referencebrowserwidget/trunk/src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.js	Wed Dec  8 01:07:02 2010
@@ -129,7 +129,7 @@
     if (multi === 0) {
         jq('#' + widget_id).attr('value', uid);
         jq('#' + widget_id + '_label').attr('value', label);
-    }  else {
+    } else {
         // check if the item isn't already in the list
         current_values = jq('#' + widget_id + ' input');
         for (i = 0; i < current_values.length; i++) {
@@ -141,7 +141,8 @@
         list = document.getElementById(widget_id);
         // add ul-element to DOM, if it is not there
         if (list === null) {
-            container = jq('#archetypes-fieldname-' + widget_id + ' input + div');
+        	fieldname = widget_id.substr('ref_browser_'.length);
+            container = jq('#archetypes-fieldname-' + fieldname + ' input + div');
             if (!container.length) {
                 // fix for Plone 3.3 collections, with a weird widget-id
                 container = jq('#archetypes-fieldname-value input + div');

------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly 
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus 
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.