• Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
    Dedicated community for Japanese speakers
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
    Dedicated community for Korean speakers
Exit
0

Unable to get the property 'split' of undefined or null reference

Community Beginner ,
Jun 10, 2016 Jun 10, 2016

Copy link to clipboard

Copied

Hi,

we have developed an application with cold fusion technology. In one particular page we have few javascript code. I get the javascript error as

unable to get the property splice of undefined or null reference.

i am unable to get to know why this error comes. Along with the error it also shows the line no.

please help me with this

thanks

praveena A

Views

2.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 10, 2016 Jun 10, 2016

Copy link to clipboard

Copied

Hello, Praveena,

Please help us to help you.  We need to see your code, especially whatever function is defined that contains that line number you mentioned in the error message.

V/r,

^_^

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 20, 2016 Jun 20, 2016

Copy link to clipboard

Copied

Hello,

When I click on a drop-down where data has to be selected , I get the below error: 

err.png

Below is the code and in Error message the line no mentioned is 96 which is highlighted

<cfset listaEmpleadosMail="">

<cfloop list="#FORM.listaEmpleados#" index="elemento">

  <cfif Trim(listaEmpleadosMail) EQ "">

   <cfset listaEmpleadosMail= elemento & "@abc.com">   --- *(This is the line no 96)*--

  <cfelse>

   <cfset listaEmpleadosMail=listaEmpleadosMail & "," & elemento & "@abc.com">

  </cfif>

</cfloop>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 20, 2016 Jun 20, 2016

Copy link to clipboard

Copied

Hi, Praveena,

It never even occurred to me to point out that a CF error will give the actual line number of _code_ that generated the error; but JavaScript is a client-side script, so it will provide the line number of the HTML that is generated by the server, not the line number of the code that produced it.  My apologies - I should have been more thorough in formulating my request.

If you could, please, do a "View Source" on the HTML after the JavaScript error alert is dismissed, and provide the JavaScript function or code that is causing the issue.

V/r,

^_^

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 21, 2016 Jun 21, 2016

Copy link to clipboard

Copied

function CargarHorasInicio()
  {
  
   //Cargaremos el desplegable de horas en funcion del dia elegido y el

tipo de pista
   if ((document.forms[0].selDia.options.selectedIndex!=0))
   {
    //Variable que guarda el dia elegido
    var diaElegido=document.forms[0].selDia.options

[document.forms[0].selDia.options.selectedIndex].value;
 
    /*Vamos a crear una fecha vĆ”lida de Javascript con el dia

elegido y obtendremos el dia de
    la semana para posteriormente saber de quĆ© array vamos a

buscar*/
    arrayFecha=diaElegido.split("/")
    fechaTemporal=new Date(arrayFecha[2],arrayFecha[1]-

1,arrayFecha[0]);
    hoy=new Date();
    var fechaTemporalUTC=Date.UTC(arrayFecha[2],arrayFecha[1]-

1,arrayFecha[0]);
    var hoyUTC=Date.UTC(hoy.getYear(),hoy.getMonth(),hoy.getDate

());
    var diferenciaUTC=fechaTemporalUTC-hoyUTC;
    var diferencia=new Date(diferenciaUTC);
    indiceDia=fechaTemporal.getDate()-hoy.getDate();
    //indiceDia=diferencia.getDate()-1
    diaElegido=fechaTemporal.getDay();
    //Inicializamos el select de las horas de inicio
    InicializarSelect(document.forms[0].selHoraDesde); 


    //Rellenamos las horas
    for (i=0;i<arrayPista.length;i++)
    {
     //En caso de que haya preferencia en la hora hacemos

comprobaciones si no cargamos las horas directamente
     if (arrayRestricciones[indiceDia]!=' ')
     {
      //array de usuarios para la restriccion

asociada a ese sector
      arrayUsuariosRestriccion=arrayRestricciones[indiceDia].split('|');        -- This is line no 96 --
     
      //Esta variable controlara si la pista esta

ocupada por un usuario preferente
      ocupadoPreferente=false;
     
      if (arrayPista[indiceDia]!="")
      {
       //Veamos si el solicitante de la pista

es un usuario preferente
       //Obtenemos el array de jugadores y

sacamos al solicitante que siempre es el primero
       var arrayJugadores=arrayPista

[indiceDia].split('|');
       var jugadorSolicitante=arrayJugadores

[0]
      
       for (j=0;

((j<arrayUsuariosRestriccion.length)&&(!(ocupadoPreferente)));j++)
       {
        if (arrayUsuariosRestriccion

==jugadorSolicitante)
        {
        

ocupadoPreferente=true;
        }
       }
      
       //Si no lo ha encontrado veamos si el

que lo pide es preferente
       if (!(ocupadoPreferente))
       {
        //Esta variable controlara si

el que lo pide es preferente
        var pedidoPreferente=false;
        //Usuario que pide la pista
        usuarioPeticion='c214094';
        for (k=0;

((k<arrayUsuariosRestriccion.length)&&(!(pedidoPreferente)));k++)
        {
         if

(arrayUsuariosRestriccion==usuarioPeticion)
         {
         

pedidoPreferente=true;
         }
        }
       
        if (pedidoPreferente)
        {
         document.forms

[0].selHoraDesde.options[document.forms[0].selHoraDesde.length]=new Option(arrayHoras

,arrayHoras)
        }
      
       }
      }
      else if (arrayPista[indiceDia]=="")
      {
       document.forms

[0].selHoraDesde.options[document.forms[0].selHoraDesde.length]=new Option(arrayHoras

,arrayHoras)
      
      }
     }
     else
     {
      document.forms[0].selHoraDesde.options

[document.forms[0].selHoraDesde.length]=new Option(arrayHoras,arrayHoras);
     }
    }
   
   }
   //Este es el caso en que no hay dia elegido, inicializamos los

desplegables
   else if (document.forms[0].selDia.options.selectedIndex==0)
   {
    //Inicializamos el select de las horas de Inicio
    InicializarSelect(document.forms[0].selHoraDesde);
    //Inicializamos el selecxt de las horas de fin
    InicializarSelect(document.forms[0].selHoraHasta);
   }
  }

I don't know whether it will help you...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 21, 2016 Jun 21, 2016

Copy link to clipboard

Copied

I'm not versed in any languages other than English, so translating your code comments will be difficult, but I think I'll still be able to follow your logic.  I'll see what I can find.

V/r,

^_^

UPDATE:  One thing that is kind of throwing me off balance is you reference an array called "arrayPista", but I do not see arrayPista being defined or initialized prior to it.  I am assuming that arrayPista is an array created outside of this function.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 21, 2016 Jun 21, 2016

Copy link to clipboard

Copied

praveenaa11254626,

As far as I can tell, there are three objects that are not being defined within this function (arrayPista, arrayRestricciones, arrayUsuariosRestriccion).  If they are being defined outside of this function, you need to make them available to this function.

If they are being defined inside another function, you need to var the container/variable at the top of the script, first.  If they are being defined globally, check if you are preceding the variable name with var.  Your line 96 is trying to create an array from an array of arrays (I think), but the array of arrays is not defined (or not globally available) at that point.

HTH,

^_^

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 23, 2016 Jun 23, 2016

Copy link to clipboard

Copied

Thank you for your comments. Indeed great help from you

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 21, 2016 Jun 21, 2016

Copy link to clipboard

Copied

  arrayUsuariosRestriccion=arrayRestricciones[indiceDia].split('|');

Does arrayRestricciones[indiceDia] exist and is it a string? Test using alert().

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 23, 2016 Jun 23, 2016

Copy link to clipboard

Copied

Thanks a lot for your suggestions and help!!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 23, 2016 Jun 23, 2016

Copy link to clipboard

Copied

LATEST

As you said , tried alert message for  arrayUsuariosRestriccion. I got the below message. Empty.empty.png

Thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation