Skip to main content
praveenaa11254626
Participating Frequently
June 10, 2016
Question

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

  • June 10, 2016
  • 1 reply
  • 2580 views

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

    This topic has been closed for replies.

    1 reply

    WolfShade
    Legend
    June 10, 2016

    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,

    ^_^

    praveenaa11254626
    Participating Frequently
    June 20, 2016

    Hello,

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

    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>

    praveenaa11254626
    Participating Frequently
    June 21, 2016

    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,

    ^_^


    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...