function IsNumeric(strString)
// check for valid numeric strings
{
var strValidChars = "0123456789.-";
var strChar;
var blnResult = true;
if (strString.length == 0) return false;
// test strString consists of valid characters listed above
for (i = 0; i < strString.length && blnResult == true; i++)
{
strChar = strString.charAt(i);
if (strValidChars.indexOf(strChar) == -1)
{
blnResult = false;
}
}
return blnResult;
}
function SaveLP(){
var txtLessonName = document.getElementById('ctl00_MainContent_txtLessonName').value;
var txtAgeLow = document.getElementById("ctl00_MainContent_txtAgeLow").value;
var txtAgeHigh = document.getElementById("ctl00_MainContent_txtAgeHigh").value;
if (!IsNumeric(txtAgeLow) * 1)
{
alert("Please enter a number in Age Range Low and High.");
return false;
}
if (!IsNumeric(txtAgeHigh) * 1)
{
alert("Please enter a number in Age Range Low and High.");
return false;
}
if (txtLessonName == '')
{
alert("Please enter a name for this Lesson Plan");
return false;
}
if (txtAgeLow == ''||txtAgeHigh==''||txtAgeLow == '0'||txtAgeHigh=='0')
{
alert("Please enter a number in Age Range Low and High.");
return false;
}
if (txtAgeLow > txtAgeHigh )
{
alert("Age Range Low must be less then Age Range High.");
return false;
}
return true;
}
|