﻿// JScript File

function ValidateString(tbx, stooltip) 
{
    var str = tbx.value;      
    var splitStr = str.split(" ");
    
    for(i = 0; i < splitStr.length; i++) 
    {
        switch(splitStr[i].toUpperCase())
        {
            case "DECLARE":
            case "CHAR":
            case "SET":
            case "CAST":
            case "CONVERT": 
            case "DELETE": 
            case "DROP": 
            case "EXEC": 
            case "INSERT": 
            case "META": 
            case "SCRIPT": 
            case "SELECT": 
            case "TRUNCATE": 
            case "UPDATE": 
            {                
                alert("The value '" + splitStr[i] + "' you have entered for " + stooltip + " is not allowed.\nPlease call 6210 6688 if you require assistance.");
                return false;
            }
            default:
                break;
        }
    }
    
    return true;    //if none of the string matches the sensitive words then return true.
}

// Special function for textboxes that can allow "CHAR" and "SET".
// To use this function for certain textbox, place a "*" in the tooltip.
function ValidateString2(tbx, stooltip) 
{
    var str = tbx.value;      
    var splitStr = str.split(" ");
    
    for(i = 0; i < splitStr.length; i++) 
    {
        switch(splitStr[i].toUpperCase())
        {
            case "DECLARE":
            //case "CHAR":
            //case "SET":
            case "CAST":
            case "CONVERT": 
            case "DELETE": 
            case "DROP": 
            case "EXEC": 
            case "INSERT": 
            case "META": 
            case "SCRIPT": 
            case "SELECT": 
            case "TRUNCATE": 
            case "UPDATE": 
            {                
                alert("The value '" + splitStr[i] + "' you have entered for " + stooltip + " is not allowed.\nPlease call 6210 6688 if you require assistance.");
                return false;
            }
            default:
                break;
        }
    }
    
    return true;    //if none of the string matches the sensitive words then return true.
}