Click to See Complete Forum and Search --> : how to do decimal point/ float validation code?


wayne.kw
06-22-2005, 02:51 AM
i need to do 1 coding, that's jus allow my text box in my form insert/ fill in decimal point.....or when i type a integer....it will change to decimal point/float....any1 know how to do this validation? besides tat....strictly reject character....pls help me......! pls....! thanks ya....! :eek:

buntine
06-22-2005, 02:56 AM
Something like this:

Dim dblValue

If IsNumeric(yourValue) Then
dblValue = CDbl(yourValue)
Else
Response.Write "Needs to be numeric"
Response.End
End If

?

Regards.

wayne.kw
06-22-2005, 04:43 AM
tis is good....! thank u! but is it posible to use javascript? let say we will call the function using onBlur/ onChange.....only wif this way, we can use [alert("Pls enter numeric")....] is it more better? because i need to do a pop up msg when the value in the text box is invalid...thanks...again.....

scragar
06-22-2005, 04:47 AM
using javascript just edit your form tag:<form onsubmit="if(!Number(this.MustBeNumber.value)){alert('please enter a number'); return false;};">