data validization

Results 1 to 3 of 3

Thread: data validization

  1. #1
    guesswho Guest

    Default data validization

    I am pretty new to ASP, so this question might sound silly. I have write data to the SQL-Server from the ASP page. There are fields of different types. I need to perform data validization for the fields so that the user doesn&#039;t enter alphabets where you have to enter numbers, month entered in place of date, etc. I am not very sure as how to go about this. Can anyone please provide some advice/suggestions or/and provide me with some sample codes.<BR> Thanks in advance.<BR>~ Sonu

  2. #2
    Join Date
    Dec 1969

    Default RE: data validization

    read about regular expressions or better about javascript to start..

  3. #3
    Ed Z Guest

    Default RE: data validation

    There are two ways you can validate user input. One way is to validate the data on the client side, before it is submitted to the server. You would probably want to use javascript to do this, so it works in both NS & IE. You can find many javascript validation scripts on the web. is a good place to begin. Of course, if your audience only uses IE, perhaps an intranet scenario, you can use VBscript on the client-side for validation.<BR><BR>Alternatively, you can submit the data to the server and use VBscript functions like isdate(), isnull(), isnumeric() to perform the validation. This is slower however because of the round trips to the server. You must also send the user back an error message and recreate the form as they originally submitted it, so this approach generally requires more code.<BR><BR>I will generally go with client-side javascript validation for simple stuff like required fields, dates, numbers, etc.<BR><BR>I would only use server-side validation if I had to query the database for some reason to determine the validity of a record.<BR><BR>Of course, if you know VBscript not javascript, you may find it easier to do your validation server-side regardless of the pros/cons. But if you&#039;re doing web development, sooner or later you have to learn javascript.

Posting Permissions

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