[eGroupWare-svn] r55812 - /trunk/egroupware/api/js/etemplate/et2_widget_selectbox.js

[email protected]
Newsgroups gmane.comp.web.egroupware.cvs
Message-ID <[email protected]>
Author: ralfbecker
Date: Sat Apr 23 18:11:28 2016
New Revision: 55812

URL: http://svn.stylite.de/viewvc/egroupware?rev=55812&view=rev
Log:
fix autorepeated id "cat[3]" would pick array element 3 from cat

Modified:
    trunk/egroupware/api/js/etemplate/et2_widget_selectbox.js

Modified: trunk/egroupware/api/js/etemplate/et2_widget_selectbox.js
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/js/etemplate/et2_widget_selectbox.js?rev=55812&r1=55811&r2=55812&view=diff
==============================================================================
--- trunk/egroupware/api/js/etemplate/et2_widget_selectbox.js (original)
+++ trunk/egroupware/api/js/etemplate/et2_widget_selectbox.js Sat Apr 23 18:11:28 2016
@@ -882,7 +882,9 @@
 			// Try first according to ID
 			content_options = widget.getArrayMgr("sel_options").getEntry(widget.id);
 			// ID can get set to an array with 0 => ' ' - not useful
-			if(content_options && content_options.length == 1 && typeof content_options[0] == 'string' && content_options[0].trim() == '')
+			if (content_options && (content_options.length == 1 && typeof content_options[0] == 'string' && content_options[0].trim() == '' ||
+				// eg. autorepeated id "cat[3]" would pick array element 3 from cat
+				typeof content_options.value != 'undefined' && typeof content_options.label != 'undefined' && widget.id.match(/\[\d+\]$/)))
 			{
 				content_options = null;
 			}
@@ -918,7 +920,7 @@
 					// Double check, might have found a normal parent namespace ( eg subgrid in subgrid[selectbox] )
 					// with an empty entry for the selecbox.  If there were valid options here,
 					// we would have found them already, and keeping this would result in the ID as an option
-					if(content_options && typeof content_options[last] != 'undefined' && content_options[last] )
+					if(content_options && !jQuery.isArray(content_options) && typeof content_options[last] != 'undefined' && content_options[last] )
 					{
 						content_options = content_options[last];
 					}


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
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.