From 0abcd5e68f9cf6c9b7af1665d287f4d33ca31cbc Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 23 Jul 2014 09:14:24 +0000 Subject: [PATCH] Refine select option searching when the id is like parent[selectbox]. - only search parents when the ID has multiple parts - fix case when selectbox was in the sel_options arrayMgr, but had no options, parent was used as select options --- etemplate/js/et2_widget_selectbox.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/etemplate/js/et2_widget_selectbox.js b/etemplate/js/et2_widget_selectbox.js index cce0683055..1a78c7810a 100644 --- a/etemplate/js/et2_widget_selectbox.js +++ b/etemplate/js/et2_widget_selectbox.js @@ -791,13 +791,21 @@ jQuery.extend(et2_selectbox, } // Try name like widget[$row] - if(!content_options || content_options.length == 0) + if(name_parts.length > 1 && (!content_options || content_options.length == 0 )) { var pop_that = jQuery.extend([],name_parts); while(pop_that.length > 0 && (!content_options || content_options.length == 0)) { - pop_that.pop(); + var last = pop_that.pop(); content_options = widget.getArrayMgr('sel_options').getEntry(pop_that.join('[')); + + // 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] ) + { + content_options = content_options[last]; + } } }