BUG 10253 Error al usar Dependent fields con Suggest field SOLVED
- El proceso adjunto muestra el error. - Fix bug in suggest fields.
This commit is contained in:
@@ -162,7 +162,7 @@ function G_Field ( form, element, name )
|
||||
for(var i=0;i<newcont.length;i++) {
|
||||
//alert(newcont[i].name + '-' + newcont[i].value);
|
||||
var j=me.form.getElementIdByName(newcont[i].name);
|
||||
if (me.form.aElements[j] != 'undefined' ) {
|
||||
if (typeof(me.form.aElements[j]) != 'undefined' ) {
|
||||
me.form.aElements[j].setValue(newcont[i].value);
|
||||
me.form.aElements[j].setContent(newcont[i].content);
|
||||
me.form.aElements[j].updateDepententFields();
|
||||
|
||||
@@ -955,9 +955,9 @@ parent=parent.parentNode;parent.style.display='none';};this.show=function(parent
|
||||
parent=parent.parentNode;parent.style.display='';};this.setDependentFields=function(dependentFields){var i;if(dependentFields.indexOf(',')>-1){dependentFields=dependentFields.split(',');}
|
||||
else{dependentFields=dependentFields.split('|');}
|
||||
for(i=0;i<dependentFields.length;i++){if(me.form.getElementIdByName(dependentFields[i])>=0){me.dependentFields[i]=me.form.getElementByName(dependentFields[i]);me.dependentFields[i].addDependencie(me);}}};this.addDependencie=function(field){var exists=false;for(i=0;i<me.dependentOf.length;i++)
|
||||
if(me.dependentOf[i]===field)exists=true;if(!exists)me.dependentOf[i]=field;};this.updateDepententFields=function(event){var tempValue;if(me.dependentFields.length===0)return true;var fields=[],Fields=[],i,grid='',row=0;for(i in me.dependentFields){console.log("Campos dependient");console.log(i);if(me.dependentFields[i].dependentOf){for(var j=0;j<me.dependentFields[i].dependentOf.length;j++){var oAux=me.dependentFields[i].dependentOf[j];if(oAux.name.indexOf('][')>-1){var aAux=oAux.name.split('][');grid=aAux[0];row=aAux[1];fieldName=aAux[2];if(Fields.length>0){aux=Fields;aux.push('?');if(aux.join('*').indexOf(fieldName+'*')==-1){Fields.push(fieldName);eval("var oAux2 = {"+fieldName+":'"+oAux.value()+"'}");fields=fields.concat(oAux2);}}else{Fields.push(fieldName);eval("var oAux2 = {"+fieldName+":'"+oAux.value()+"'}");fields=fields.concat(oAux2);}}
|
||||
if(me.dependentOf[i]===field)exists=true;if(!exists)me.dependentOf[i]=field;};this.updateDepententFields=function(event){var tempValue;if(me.dependentFields.length===0)return true;var fields=[],Fields=[],i,grid='',row=0;for(i in me.dependentFields){if(me.dependentFields[i].dependentOf){for(var j=0;j<me.dependentFields[i].dependentOf.length;j++){var oAux=me.dependentFields[i].dependentOf[j];if(oAux.name.indexOf('][')>-1){var aAux=oAux.name.split('][');grid=aAux[0];row=aAux[1];fieldName=aAux[2];if(Fields.length>0){aux=Fields;aux.push('?');if(aux.join('*').indexOf(fieldName+'*')==-1){Fields.push(fieldName);eval("var oAux2 = {"+fieldName+":'"+oAux.value()+"'}");fields=fields.concat(oAux2);}}else{Fields.push(fieldName);eval("var oAux2 = {"+fieldName+":'"+oAux.value()+"'}");fields=fields.concat(oAux2);}}
|
||||
else{aux=Fields;aux.push('?');oAux=me.dependentFields[i].dependentOf[0];if(Fields.length>0){if(aux.join('*').indexOf(oAux.name+'*')==-1){Fields.push(oAux.name);fields=fields.concat(me.dependentFields[i].dependentOf);}}else{Fields.push(oAux.name);fields=fields.concat(me.dependentFields[i].dependentOf);}}}}}
|
||||
var callServer;callServer=new leimnud.module.rpc.xmlhttp({url:me.form.ajaxServer,async:false,method:"POST",args:"function=reloadField&"+'form='+encodeURIComponent(me.form.id)+'&fields='+encodeURIComponent(fields.toJSONString())+(grid!=''?'&grid='+grid:'')+(row>0?'&row='+row:'')});callServer.make();var response=callServer.xmlhttp.responseText;if(response.substr(0,1)==='['){var newcont;eval('newcont='+response+';');if(grid==''){for(var i=0;i<newcont.length;i++){var j=me.form.getElementIdByName(newcont[i].name);if(me.form.aElements[j]!='undefined'){me.form.aElements[j].setValue(newcont[i].value);me.form.aElements[j].setContent(newcont[i].content);me.form.aElements[j].updateDepententFields();}}}
|
||||
var callServer;callServer=new leimnud.module.rpc.xmlhttp({url:me.form.ajaxServer,async:false,method:"POST",args:"function=reloadField&"+'form='+encodeURIComponent(me.form.id)+'&fields='+encodeURIComponent(fields.toJSONString())+(grid!=''?'&grid='+grid:'')+(row>0?'&row='+row:'')});callServer.make();var response=callServer.xmlhttp.responseText;if(response.substr(0,1)==='['){var newcont;eval('newcont='+response+';');if(grid==''){for(var i=0;i<newcont.length;i++){var j=me.form.getElementIdByName(newcont[i].name);if(typeof(me.form.aElements[j])!='undefined'){me.form.aElements[j].setValue(newcont[i].value);me.form.aElements[j].setContent(newcont[i].content);me.form.aElements[j].updateDepententFields();}}}
|
||||
else{for(var i=0;i<newcont.length;i++){var oAux=me.form.getElementByName(grid);if(oAux){var oAux2=oAux.getElementByName(row,newcont[i].name);if(oAux2){oAux2.setValue(newcont[i].value);oAux2.setContent(newcont[i].content);oAux2.updateDepententFields();}}}}}else{alert('Invalid response: '+response);}
|
||||
return true;};this.setValue=function(newValue){me.element.value=newValue;};this.setContent=function(newContent){};this.setAttributes=function(attributes){for(var a in attributes){if(a=='formula'&&attributes[a]){sumaformu(this.element,attributes[a],attributes['mask']);}
|
||||
switch(typeof(attributes[a])){case'string':case'int':case'boolean':if(a!='strTo'){switch(true){case typeof(me[a])==='undefined':case typeof(me[a])==='object':case typeof(me[a])==='function':case a==='isObject':case a==='isArray':break;default:me[a]=attributes[a];}}
|
||||
|
||||
@@ -154,6 +154,11 @@ select XMLNODE_NAME, XMLNODE_NAME AS NAME FROM dynaForm WHERE XMLNODE_NAME <> @@
|
||||
|
||||
var dyntype = "@#PME_DYN_TYPE";
|
||||
|
||||
if (dyntype == 'grid') {
|
||||
hideRowById('PME_DEPENDENTFIELDS');
|
||||
} else {
|
||||
showRowById('PME_DEPENDENTFIELDS');
|
||||
}
|
||||
storeNewEntriesOptions(getField("PME_STORE_NEW_ENTRY"));
|
||||
|
||||
leimnud.event.add(
|
||||
|
||||
Reference in New Issue
Block a user