Reply to Numbers in forms, 0.5 vs .5

Your name:

Reply:


Posted by rjames.clarke on 09/16/05 15:25

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.testform.actual_value.value <
document.testform.upper_limit.value) &&
(document.testform.actual_value.value >
document.testform.lower_limit.value))
{
alert("Data Good\n\nWriting the Data\n to the Database")
document.testform.pass_fail.value="P"
return true
}
else
{
input_box=confirm("Click OK to record a NC or Cancel to Re-enter");
if (input_box==true)
{
// 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
}
}

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация