SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Form Validation

  1. #1
    SitePoint Member
    Join Date
    Sep 2012
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Form Validation

    Hi there,

    I'm having some trouble with validating input from the user.

    The forms I have are.

    Username
    Pwd1 = Password
    Pwd2 = Confirm Password
    Group
    Email
    Surname
    Forename

    When the user click submit I need to loop through each of the forms and if any of them are empty I need to display the appropriate error message. I need to set these two item (Is_Error = True) and (ErrMsg = "Whatever")

    Then what will need happen is:

    Code:
    If (IS_Empty = True) Then
        'The loop through and display all the error messages
    Else
         'Process the form.
    End If

    Can anyone help?


    Thanks

  2. #2
    SitePoint Enthusiast
    Join Date
    Jan 2012
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You will have to do something like :

    Code:
    IS_Empty = False
    ErrMsg =""
    For each x in Request.Form
       if Request(x)="" Then
           IS_Empty = True
           ErrMsg = ErrMsg & x & " is blank <br>"
       end if
    Next
    For the error message to be meaningful, you will have to name your form fields accordingly.

    A message like "PW2 is blank" wont make much sense to the user.


Tags for this Thread

Bookmarks

Posting Permissions

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