// Wizard Helper JavaScript class to communicate with the WizardHelper PHP class if (!Array.prototype.indexOf) // Emulation of the indexOf function for IE and old browsers { Array.prototype.indexOf = function(elt /*, from*/) { var len = this.length; var from = Number(arguments[1]) || 0; from = (from < 0) ? Math.ceil(from) : Math.floor(from); if (from < 0) from += len; for (; from < len; from++) { if (from in this && this[from] === elt) return from; } return -1; }; } function WizardHelper(sClass, sFormPrefix) { this.m_oData = { 'm_sClass' : '', 'm_oFieldsMap': {}, 'm_oCurrentValues': {}, 'm_aDefaultValueRequested': [], 'm_aAllowedValuesRequested': [], 'm_oDefaultValue': {}, 'm_oAllowedValues': {}, 'm_iFieldsCount' : 0, 'm_sFormPrefix' : sFormPrefix }; this.m_oData.m_sClass = sClass; // Methods this.SetFieldsMap = function (oFieldsMap) { this.m_oData.m_oFieldsMap = oFieldsMap; } this.SetFieldsCount = function (count) { this.m_oData.m_iFieldsCount = count; } this.GetFieldId = function(sFieldName) { id = this.m_oData.m_oFieldsMap[sFieldName]; return id; } this.RequestDefaultValue = function (sFieldName) { currentValue = this.UpdateCurrentValue(sFieldName); if (currentValue == null) { this.m_oData.m_aDefaultValueRequested.push(sFieldName); } } this.RequestAllowedValues = function (sFieldName) { this.m_oData.m_aAllowedValuesRequested.push(sFieldName); } this.SetCurrentValue = function (sFieldName, currentValue) { this.m_oData.m_oCurrentValues[sFieldName] = currentValue; } this.ToJSON = function () { return JSON.stringify(this.m_oData); } this.FromJSON = function (sJSON) { //console.log('Parsing JSON:'+sJSON); this.m_oData = JSON.parse(sJSON); } this.ResetQuery = function () { this.m_oData.m_aDefaultValueRequested = []; this.m_oData.m_oDefaultValue = {}; this.m_oData.m_aAllowedValuesRequested = []; this.m_oData.m_oAllowedValues = {}; } this.UpdateFields = function () { var aRefreshed = []; //console.log('** UpdateFields **'); // Set the full HTML for the input field for(i=0; i'); this.RequestAllowedValues(sAttCode); index++; } this.AjaxQueryServer(); } }