Scott.Atkinson
09-24-2011, 10:21 AM
Hi All,
i have a javascript function which i pass 3 fields to which then check to see if they are empty but the two other fields txtDeveloperDetailEstimate and TxtAldonTaskNumber are numeric and i need to check for != NaN but when i fill something in to the comment area it comes back as red even though there is some text in it, how can i check for the numeric values of the other two without interupting the first check for comments etc?
var DevFieldCheck = Array('MainDisplayContentChange_txtDeveloperComment', 'MainDisplayContentChange_txtDeveloperDetailEstimate', 'MainDisplayContentChange_txtAldonTaskNumber');
var obj;
function DevItemCheck(windowname) {
for (var i = 0; i < DevFieldCheck.length; i++) {
obj = document.getElementById(DevFieldCheck[i]);
if (obj.value == "" || obj.value == 0 || obj.value != NaN)
{
obj.style.backgroundColor = "#B20635";
return false;
}
}
Businesspopup(windowname)
}
Any help will be highly appreciated.
**Update**
Iv tried this aswell but it still turns red when there is a number in there :(
var DevFieldCheck = Array('MainDisplayContentChange_txtDeveloperComment');
var obj;
function DevItemCheck(windowname)
{
for (var i = 0; i < DevFieldCheck.length; i++)
{
obj = document.getElementById(DevFieldCheck[i]);
if (obj.value == "" || obj.value == 0) {
obj.style.backgroundColor = "#B20635";
return false;
}
}
if (document.getElementById('MainDisplayContentChange_txtDeveloperDetailEstimate').value = NaN)
{
document.getElementById('MainDisplayContentChange_txtDeveloperDetailEstimate').style.backgroundColor = "#B20635";
return false;
}
if (document.getElementById('MainDisplayContentChange_txtAldonTaskNumber').value == NaN)
{
document.getElementById('MainDisplayContentChange_txtAldonTaskNumber').style.backgroundColor = "#B20635";
return false;
}
AnotherDevpopup(windowname)
}
Im aware i have one line with "=" and the other with "==" i was testing both out...to see if it made a difference
i have a javascript function which i pass 3 fields to which then check to see if they are empty but the two other fields txtDeveloperDetailEstimate and TxtAldonTaskNumber are numeric and i need to check for != NaN but when i fill something in to the comment area it comes back as red even though there is some text in it, how can i check for the numeric values of the other two without interupting the first check for comments etc?
var DevFieldCheck = Array('MainDisplayContentChange_txtDeveloperComment', 'MainDisplayContentChange_txtDeveloperDetailEstimate', 'MainDisplayContentChange_txtAldonTaskNumber');
var obj;
function DevItemCheck(windowname) {
for (var i = 0; i < DevFieldCheck.length; i++) {
obj = document.getElementById(DevFieldCheck[i]);
if (obj.value == "" || obj.value == 0 || obj.value != NaN)
{
obj.style.backgroundColor = "#B20635";
return false;
}
}
Businesspopup(windowname)
}
Any help will be highly appreciated.
**Update**
Iv tried this aswell but it still turns red when there is a number in there :(
var DevFieldCheck = Array('MainDisplayContentChange_txtDeveloperComment');
var obj;
function DevItemCheck(windowname)
{
for (var i = 0; i < DevFieldCheck.length; i++)
{
obj = document.getElementById(DevFieldCheck[i]);
if (obj.value == "" || obj.value == 0) {
obj.style.backgroundColor = "#B20635";
return false;
}
}
if (document.getElementById('MainDisplayContentChange_txtDeveloperDetailEstimate').value = NaN)
{
document.getElementById('MainDisplayContentChange_txtDeveloperDetailEstimate').style.backgroundColor = "#B20635";
return false;
}
if (document.getElementById('MainDisplayContentChange_txtAldonTaskNumber').value == NaN)
{
document.getElementById('MainDisplayContentChange_txtAldonTaskNumber').style.backgroundColor = "#B20635";
return false;
}
AnotherDevpopup(windowname)
}
Im aware i have one line with "=" and the other with "==" i was testing both out...to see if it made a difference