r13340 - 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 09:12:04 2010
New Revision: 13340

Modified:
   MoreFieldsAndWidgets/archetypes.referencebrowserwidget/trunk/src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.js
Log:
fixed : name wouldn't have 'ref_browser_' prefix, saving values was broken !!

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 09:12:04 2010
@@ -124,6 +124,7 @@
         up_element = null,
         down_element = null,
         container = null;
+    	fieldname = null;
     // differentiate between the single and mulitselect widget
     // since the single widget has an extra label field.
     if (multi === 0) {
@@ -138,10 +139,10 @@
             }
         }
         // now add the new item
+        var fieldname = widget_id.substr('ref_browser_'.length);
         list = document.getElementById(widget_id);
         // add ul-element to DOM, if it is not there
         if (list === null) {
-        	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
@@ -157,7 +158,7 @@
         input.type = 'checkbox';
         input.value = uid;
         input.checked = true;
-        input.name = widget_id + ':list';
+        input.name = fieldname + ':list';
         label_element.appendChild(input);
         label_element.appendChild(document.createTextNode(' ' + label));
         li.appendChild(label_element);
@@ -340,7 +341,7 @@
 
 function refreshOverlay(wrap, srcfilter, newoption) {
     var oldhistory = jq('[id^=atrb_] form#history select');
-    wrap.load(srcfilter, function() { 
+    wrap.load(srcfilter, function() {
         jq('[id^=atrb_] form#history select').append(newoption + oldhistory.html());
         ov = jq('div#content').data('overlay');
         widget_id = ov.getTrigger().attr('rel').substring(6);

------------------------------------------------------------------------------
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.