/** * */ var CJTSimpleErrorDialog; /** * */ (function($) { /** * put your comment there... * * @param form */ CJTSimpleErrorDialog = function(form) { /** * put your comment there... * */ var inlineElement; /** * put your comment there... * * @type String */ var onset = ''; /** * */ this.errors = []; /** * */ this.fields = {}; /** * */ this.add = function(name, expression, message) { // Set fieldset name. name = onset + name; this.fields[name] = { name: name, expression: expression, message : message } return this; } /** * */ this.clear = function() { this.errors = []; return this; } /** * */ this.fetchFieldInfo = function(field) { // Initialize vars! var info = {}; // Use Object element directly of get it if the name is passed! if (typeof field != 'object') { if (!this.fields[field]) { throw 'Field name doesn\'t exists'; } // Fetch field by name! field = form.prop(field); } // Make sure its jQuery object! field = $(field); //Fetch info. info.text = form.find('label[for=' + field.prop('id') + ']').text().replace('*', ''); return info; } /** * */ this.hasError = function() { return this.errors.length ? true : false; } /** * */ this.onSet = function(name) { onset = name; return this; } /** * put your comment there... * * @param tab_name * * @returns {Boolean} */ this.show = function(tbParams, showName) { // Thick box URI. var thickBoxParameters = '?TB_inline&_TB-PARAMS_&inlineId=' + inlineElement.prop('id'); // Add tbParams if defined! if (tbParams != undefined) { thickBoxParameters = thickBoxParameters.replace('_TB-PARAMS_', tbParams); } // Remove all child elements inside the Error inline element. inlineElement.find('ul').remove(); // Add error list element. var errsList = $('