Form validation ...

Results 1 to 2 of 2

Thread: Form validation ...

  1. #1
    Join Date
    Dec 1969

    Default Form validation ...

    Probably a very simple solution, but it eludes me.<BR><BR>I need to confirm that a field is a number only (any number) before trying to send the data into an Access database. How would I go about doing this?<BR><BR>Thanks a million,<BR>JC

  2. #2
    Join Date
    Dec 1969

    Default RE: Form validation ...

    on form submit click or in the form onSubmit event call this function. send your textbox as input parameter and its name<BR>/************************************************** **************/<BR><BR>// Returns true if the string passed in is a valid number<BR>// (no alpha characters), else it displays an error message<BR><BR>function ForceNumber(objField, FieldName)<BR>{<BR> var strField = new String(objField.value);<BR> <BR> if (isWhitespace(strField)) return true;<BR><BR> var i = 0;<BR><BR> for (i = 0; i &#060; strField.length; i++)<BR> if (strField.charAt(i) &#060; &#039;0&#039; &#124&#124 strField.charAt(i) &#062; &#039;9&#039;) {<BR> alert(FieldName + " must be a valid numeric entry. Please do not use commas or dollar signs or any non-numeric symbols.");<BR> objField.focus();<BR> return false;<BR> }<BR><BR> return true;<BR>}<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