Hi guys,
I am pretty new here and this is my first post. Please accept my appolgy if this post is worng place.
I have been assigned new project in our company, previous guy left me a total rubbish. He used dHTMLX and put more than 18000 lines of code in a single JS file.
Anyway, now i am trying to find out some solution as i describe in this post’s subject. So, i have to close opened window after save and refresh previous screen.
Here is my code.
[code]CF.attachEvent("onValidateError", function (name, value, result){
if(!result)
{
Label = CF.getItemLabel(name);
CurrentErrorMessages.push('"'+Label+'" cannot be empty.');
}
a.progressOff();
b.progressOff();
return false;
});
CF.attachEvent("onButtonClick",function(id){
if(id=="currentform-send")
{
CurrentErrorMessages = [];
var vld = CF.validate();
if(!vld && CurrentErrorMessages.length>0){
dhtmlx.message({ title:"Error",text:CurrentErrorMessages.join("<br>") });
return false;
}
var NotCSVString = CFN.serializeToCSV();
CF.setItemValue("Notes",NotCSVString);
a.progressOn();
b.progressOn();
CF.send("/api/current/save", function(loader, response){
a.progressOff();
setTimeout(function(){ b.progressOff(); },200);
json_res = JSON.parse(response);
if(json_res['status']=='ERROR'){
dhtmlx.alert({ title:"Error",type:"alert-error",text:json_res['error_message'] });
}
else if(json_res['status']=='OK')
{
dhtmlx.message({text: "Success" });
}
});
}
});[/code]
I appreciate for any help