Hi all,
I am (have) wrote an intranet industrial app that requires the user to
enter a number which is compared to a high and low limit. If the low
or high limits have a 0 in front of the decmial the entered value must
also.
The actual comparison is done in javascript as pasted below. If a
return true is given then the data is written to the database.
ex
low limit 0.5
high limit 0.6
entered value .55 is returned as OUT OF TOLERANCE CONDITION
whereas entered value of 0.55 is returned as GOOD!
For the time being I have consoled my users to be sure to enter a
leading 0 when dealing with decimals.
How do I correct this, such that .5 and 0.5 are considered valid
entries?
if ((document.test form.actual_val ue.value <
document.testfo rm.upper_limit. value) &&
(document.testf orm.actual_valu e.value >
document.testfo rm.lower_limit. value))
{
alert("Data Good\n\nWriting the Data\n to the Database")
document.testfo rm.pass_fail.va lue="P"
return true
}
else
{
input_box=confi rm("Click OK to record a NC or Cancel to Re-enter");
if (input_box==tru e)
{
// Output when OK is clicked
alert ("You clicked NC, TAG the item as REJECT (RED)");
return true
}
else
{
// Output when Cancel is clicked
alert ("You clicked cancel");
return false
}
}
I am (have) wrote an intranet industrial app that requires the user to
enter a number which is compared to a high and low limit. If the low
or high limits have a 0 in front of the decmial the entered value must
also.
The actual comparison is done in javascript as pasted below. If a
return true is given then the data is written to the database.
ex
low limit 0.5
high limit 0.6
entered value .55 is returned as OUT OF TOLERANCE CONDITION
whereas entered value of 0.55 is returned as GOOD!
For the time being I have consoled my users to be sure to enter a
leading 0 when dealing with decimals.
How do I correct this, such that .5 and 0.5 are considered valid
entries?
if ((document.test form.actual_val ue.value <
document.testfo rm.upper_limit. value) &&
(document.testf orm.actual_valu e.value >
document.testfo rm.lower_limit. value))
{
alert("Data Good\n\nWriting the Data\n to the Database")
document.testfo rm.pass_fail.va lue="P"
return true
}
else
{
input_box=confi rm("Click OK to record a NC or Cancel to Re-enter");
if (input_box==tru e)
{
// Output when OK is clicked
alert ("You clicked NC, TAG the item as REJECT (RED)");
return true
}
else
{
// Output when Cancel is clicked
alert ("You clicked cancel");
return false
}
}
Comment