Looking for numbers in a name...

Results 1 to 2 of 2

Thread: Looking for numbers in a name...

  1. #1
    Join Date
    Dec 1969

    Default Looking for numbers in a name...

    Hi<BR>I&#039;m very new to ASP and desperatley need your help. I want to provide server side verification and validation of a text box which is for inputting a firstname. I want the ASP code to look at the text box and check to make sure the user has not entered a blank field or put a number in their name. How do I do this? Please help.<BR><BR>Thanks<BR><BR>Neil Head

  2. #2
    Join Date
    Dec 1969

    Default RE: Looking for numbers in a name...

    Does it have to be server side validation? JavaScript is extremely well suited for this, and there are tons of exampls out there.<BR><BR>If it&#039;s server side you want, pass the form field to a variable. I use strTest.<BR><BR>Dim strTest<BR>strTest = Request.Form("The_name_of_your_form_field")<BR><BR >Now, to test if empty:<BR><BR>If ("" & strTest) = "" Then<BR> &#039;-- some action<BR>Else<BR> &#039;--- Some other action if NOT empty.<BR>End If<BR><BR>As far as numbers go, I am sure there are folks here who can give you a much more eloquent example, especially if you use Regular Expressions, but a simple way to do it MIGHT be to create an array of numbers from 0 to 9, then loop the array, testing in each pass if the number from the array exists in strTest.<BR><BR>Kurt

Posting Permissions

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