cancel
Showing results for 
Search instead for 
Did you mean: 

Web Script JS code works fine in FF and it does not work IE

xoselois
Champ in-the-making
Champ in-the-making
Hi to all people,

I developed an application using Alfresco Web Scripts and it is working fine when I am using the FireFox Web browser. The problem is when I am trying to use the Internet Explorer Web browser because the same code is throwing the next exception:

Failed to execute script 'workspace://SpacesStore//Empresa/Diccionario de datos/Web Scripts Extensions/SADESI/Unidad de Recursos Humanos/Liquidación de Gastos/admision.post.js':
Failed to execute script 'workspace://SpacesStore//Empresa/Diccionario de datos/Web Scripts Extensions/SADESI/Unidad de Recursos Humanos/Liquidación de Gastos/admision.post.js':
TypeError: Cannot call method "createFile" of null (AlfrescoScript#93)

Error code: 500 (Internal Error)


The code that I am talking about (and that is throwing the exception on IE) is:



var archivo = null;
var content = null;
var espacioInicial = "";

// locate file attributes
for each (field in formdata.fields){
        …
   else if (field.name == "espacio_inicio"){
      espacioInicial = field.value;// The value comes from the admision.get.html.ftl page and it is the initial space where the document will be stored in Alfresco.
   }
   else if (field.name == "file" && field.isFile){
      archivo = field.filename;
      content = field.content;
   }
}

var fecha = new Date();

if ((archivo == undefined) || (archivo == null) || (content == undefined) || (content == null)){
   status.code = 400;
   status.message = "No se pudo localizar el Impreso de Liquidación de Gastos a introducir en Alfresco por "+nombreEmpleado+".";
   status.redirect = true;
}
else{
   // create document in company home for uploaded file
        var placeToUpload = companyhome.childByNamePath(espacioInicial);
        upload = placeToUpload.createFile(fecha.getTime()+"-"+archivo); [b]—-> line #93 of the code that throws exception[/b]

}

I have checked with several PCs and several IE versions to check that is not a problem of a specific version of browser. And the same to FireFox (no problem in this case). Any idea about what is happening?

Thanks in advance.

Xosé Lois

PS: If necessary I will upload the full code of the admision.post.js page.
1 REPLY 1

xoselois
Champ in-the-making
Champ in-the-making
I was checking the data sent from admision.get.html.ftl to admision.post.js and I found that:

Internet Explorer: (Wrong value)

13:03:17,421 DEBUG [org.alfresco.repo.jscript.ScriptLogger] espacioInicial: SADESI/Unidad de Recursos Humanos/Liquidación de Gastos/Supervisar


FireFox: (Correct value)

13:04:20,993 DEBUG [org.alfresco.repo.jscript.ScriptLogger] espacioInicial: SADESI/Unidad de Recursos Humanos/Liquidación de Gastos/Supervisar

Then, it seems that IE is not managing ISO-8859-1 codification internaly but uses UTF-8 codification. In the other hand, it seems that FireFox works as I hope. I will look for a solution in another forums but, in the case you know how to manage the problem could you, please, post here. Thanks.

Sorry for que post  :roll:

Best regards

Xosé Lois