Number Validation(again)

Results 1 to 2 of 2

Thread: Number Validation(again)

  1. #1
    Join Date
    Dec 1969

    Default Number Validation(again)

    Thanks Bill and (cheezwhiz)for the answers yesterday. <BR><BR>Yes, MSIE is just fine. It will not be accessible to everyone. <BR><BR>This works, however, it DOES NOT accept "7.5 " it makes you put in the "0". I would, though, (strange as it may seem now) like it to accept "7.5" and "7" Plus if they put in 7.567 that it checks for the two decimals. Is that possible? <BR><BR>And what about testing for a certain length like only 8 characters before the decimal?<BR><BR>I if am annoying let me know. I am new and you are really helping me. <BR><BR>thank you so much!

  2. #2
    Join Date
    Dec 1969

    Default Minor variations

    &nbsp;<BR>I forget the context of the code, but basically:<BR><BR>strNum = document.FormName.FieldName.value; &#039; or the equivalent<BR>strNum = Trim(strNum) &#039; strip of leading and trailing blanks<BR>flag = False<BR><BR>If isNumeric( strNum ) Then<BR>&nbsp; &nbsp; &#039; further check<BR>&nbsp; &nbsp; decPos = inStr( strNum, "." )<BR>&nbsp; &nbsp; If decPos = 0 OR decPos &#062;= (Len(strNum)-2) Then<BR>&nbsp; &nbsp; &nbsp; &nbsp; &#039; 123 or 12. or 12.3 or 12.34 ...<BR>&nbsp; &nbsp; &nbsp; &nbsp; num = CDbl( strNum )<BR>&nbsp; &nbsp; &nbsp; &nbsp; If num &#060;= 999999.99 Then <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#039; number is in range<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; flag = True &#039; OKAY!<BR>&nbsp; &nbsp; &nbsp; &nbsp; End If<BR>&nbsp; &nbsp; End If<BR>End If<BR><BR>If flag &#060;&#062; True Then <BR>&nbsp; &nbsp; MsgBox("Sorry, that isn&#039;t an acceptable number")<BR>&nbsp; &nbsp; ...<BR>&nbsp; &nbsp; ...<BR>End If<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts