AnsweredAssumed Answered

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

Question asked by xoselois on May 7, 2008
Latest reply on May 7, 2008 by xoselois
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.

Outcomes