Form Validation

Discussion in 'ASP General' started by solomon_13000, Jun 15, 2006.

  1. What is the best way to validate a form field and display an error
    message. Are there better examples than shown bellow?

    <%
    Sub ValidateForm(sValue,count)
    If Len(Trim(sValue)) > count then
    session("boolean") = false
    else
    session("boolean") = true
    end if
    End sub

    If request.queryString("Action") = 2 then
    username = ValidateForm(request.form("username"),12)
    if session("boolean") = true then
    password = ValidateForm(request.form("password,12)
    if session("boolean") = false then
    .....other codes
    else
    'display error msg
    end if
    else
    'display error msg
    end if
    end if

    %>
     
    solomon_13000, Jun 15, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Colin Basterfield

    Web form validation vs object validation

    Colin Basterfield, Nov 28, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    429
    Tommy
    Nov 29, 2003
  2. Sumith Mathur
    Replies:
    0
    Views:
    2,207
    Sumith Mathur
    Sep 23, 2004
  3. OriginalBrownster

    string validation/ form validation

    OriginalBrownster, Aug 21, 2006, in forum: Python
    Replies:
    1
    Views:
    423
    Simon Forman
    Aug 21, 2006
  4. Grigory Temchenko
    Replies:
    0
    Views:
    332
    Grigory Temchenko
    Dec 28, 2008
  5. bnp
    Replies:
    4
    Views:
    328
Loading...

Share This Page