[Javascript] (no subject)
shawn at milochik.com
shawn at milochik.com
Wed Nov 2 10:09:36 CST 2005
Scott,
Welcome to the list!
Let me see if I understand here.
1. You have two text boxes.
2. One must be a number at all times, the other may be blank.
3. If the first one is zero, the second must be numeric.
4. If both are numeric, the total may not exceed 8.
Please let me know if I'm understanding it correctly.
Shawn
Original Message:
-----------------
From: Scott Hamm linuxgold at gmail.com
Date: Wed, 2 Nov 2005 10:42:25 -0500
To: javascript at LaTech.edu
Subject: [Javascript] (no subject)
Hi all. I'm new to this mailing list and I'm ASP/SQL application
developer. I've been using SQL stored procedure to do error
corrections until I realize that it created high traffic between ASP
and SQL so I decided to learn javascript.
What I need for my web to do is to ensure that khrs have '0' or more
and is numeric and/or if kpto is more than '0' and is numeric AND sum
of khrs and kpto MUST not exceed 8 hours. I do not want both kph and
kpto to have '0' values at same time either. So I created this
script, everything works up to kph+kpto and I've been struggling to
figure out why.
Thanks for your help in advance.
Scott
[code]
function validateKronos()
{
digits="0123456789."
if(krono_process.assocID.options[0].selected)
{
alert("Associate is not selected")
krono_process.assocID.focus()
return false;
}
else
{
var kph=krono_process.khrs.value
len=kph.length
if(len==0)
{
alert("Hours is not indicated. Enter 0 if no hours worked.")
krono_process.khrs.focus()
return false;
}
else
{
for(i=0;i<len;i++)
{
if(digits.indexOf(kph.charAt(i))<0)
{
alert("Hours must be numeric")
krono_process.khrs.focus()
return false;
}
}
var kpp=krono_process.kpto.value
len=kpp.length
if(len!=0)
{
for(i=0;i<len;i++)
{
if(digits.indexOf(kpp.charAt(i))<0)
{
alert("PTO must be numeric")
krono_process.kpto.focus()
return false;
}
}
var kptot=krono_process.kpto.value
var khtot=krono_process.khrs.value
ktot=kpp+kph
If(ktot>8)
{
alert("Exceeding 8 hours total to use PTO")
krono_process.khrs.focus()
return false;
}
}
}
}
}
[/code]
--
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript
--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .
More information about the Javascript
mailing list