Client Script debug

I have an editable grid that I'd like to alert on if certain in the grid match a certain value.  So on Cell exit I have:

 

var myItemRow = eworkGetCurrentRow ("grdInstrumentShop");
    var strCurrentStatus = eworkGetCell("grdInstrumentShop", 6, myItemRow);
    var strtrace = eworkGetCell("grdInstrumentShop", 8, myItemRow);
    alert (" trace = " + strtrace + ");
    alert ("strCurrentStatus = " + strCurrentStatus + ");
    if((strCurrentStatus == "Fab Completed")&&(strtrace is null))
    {
         alert("Please provide the material trace information");
     }
return true;

 

Nothing ever  happens.   Even the extra alerts I added for debug don't popup.   What am I missing? 

 

Thanks!

Tagged:

Comments

  • I think the "is null" part of your script is not valid in JScript. There are a number of ways to test as far as I can see with a quick google.

     

    Frankly whenver I get into client scripting I feel as though I am working in the dark. Compared to C# it is very awkward to diagnose issues. I know you can trace through code in IE, but I must admit I avoid it so much that I have never tried to get it working, myself.

     

    BTW, there is no need to return anything, and that may cause an issue as well, I have no idea (You have to see the resulting page source to tell).

  • You were right - but I also had an error in the extra alert lines I was trying to use for debug.  Here's what works:

    function fnAlertforTrace()
     {
         var myItemRow = eworkGetCurrentRow ("grdInstrumentShop");
        var strCurrentStatus = eworkGetCell("grdInstrumentShop", 6, myItemRow);
        var strtrace = eworkGetCell("grdInstrumentShop", 8, myItemRow);
        alert (" trace = " + strtrace  );
        alert ("strCurrentStatus = " + strCurrentStatus  );
        if((strCurrentStatus == "Fab Completed")&&(strtrace == ""))
        {
        alert("Please provide the material trace information");
        }
    return true;
    }

     

    Thanks for the help!