@@ -22,7 +22,7 @@ define([
2222 opened : false ,
2323 level : 0 ,
2424 visible : true ,
25- initializeFieldsetDataByDefault : false , /* Data in some fieldsets should be initialized before open */
25+ initializeFieldsetDataByDefault : false , /* Data in some fieldsets should be initialized before open */
2626 disabled : false ,
2727 listens : {
2828 'opened' : 'onVisibilityChange'
@@ -77,9 +77,9 @@ define([
7777 elem . initContainer ( this ) ;
7878
7979 elem . on ( {
80- 'update' : this . onChildrenUpdate ,
81- 'loading' : this . onContentLoading ,
82- 'error' : this . onChildrenError
80+ 'update' : this . onChildrenUpdate ,
81+ 'loading' : this . onContentLoading ,
82+ 'error' : this . onChildrenError
8383 } ) ;
8484
8585 if ( this . disabled ) {
@@ -155,11 +155,42 @@ define([
155155 * @param {String } message - error message.
156156 */
157157 onChildrenError : function ( message ) {
158- var hasErrors = this . elems . some ( 'error' ) ;
158+ var hasErrors = false ;
159+
160+ if ( ! message ) {
161+ hasErrors = this . _isChildrenHasErrors ( hasErrors , this ) ;
162+ }
159163
160164 this . error ( hasErrors || message ) ;
161165 } ,
162166
167+ /**
168+ * Returns errors of children if exist
169+ *
170+ * @param {Boolean } hasErrors
171+ * @param {* } container
172+ * @return {Boolean }
173+ * @private
174+ */
175+ _isChildrenHasErrors : function ( hasErrors , container ) {
176+ var self = this ;
177+
178+ if ( hasErrors === false && container . hasOwnProperty ( 'elems' ) ) {
179+ hasErrors = container . elems . some ( 'error' ) ;
180+
181+ if ( hasErrors === false && container . hasOwnProperty ( '_elems' ) ) {
182+ container . _elems . forEach ( function ( child ) {
183+
184+ if ( hasErrors === false ) {
185+ hasErrors = self . _isChildrenHasErrors ( hasErrors , child ) ;
186+ }
187+ } ) ;
188+ }
189+ }
190+
191+ return hasErrors ;
192+ } ,
193+
163194 /**
164195 * Callback that sets loading property to true.
165196 */
0 commit comments