Validation Of ASP Form HELP URGENT

Discussion in 'ASP General' started by SpiderSwamy, Apr 6, 2006.

  1. SpiderSwamy

    SpiderSwamy Guest

    Hi,

    I know little bit about asp, I am facing a problem in Validating
    the ASP Form..

    Example:

    Stud ID: 501242016
    FirstName: Ajit
    LastName: Kar

    These Fileds are there in my form and I am able to Insert it into
    Database.

    But My problem is I am not able to restrict the Stud ID to 9 digit and
    if First Name , Last Names fields are empty I want to display a message
    telling please fill the Following fields.

    Anyone who have any idea on this please reply me back, its urgent.

    Thanks in Advance.

    Regards
    SpiderSwamy
    SpiderSwamy, Apr 6, 2006
    #1
    1. Advertising

  2. Gazing into my crystal ball I observed "SpiderSwamy" <manju_016
    @rediffmail.com> writing in news:1144304839.412694.294670
    @z34g2000cwc.googlegroups.com:

    > Hi,
    >
    > I know little bit about asp, I am facing a problem in Validating
    > the ASP Form..
    >
    > Example:
    >
    > Stud ID: 501242016
    > FirstName: Ajit
    > LastName: Kar
    >
    > These Fileds are there in my form and I am able to Insert it into
    > Database.
    >
    > But My problem is I am not able to restrict the Stud ID to 9 digit and
    > if First Name , Last Names fields are empty I want to display a message
    > telling please fill the Following fields.
    >
    > Anyone who have any idea on this please reply me back, its urgent.
    >
    >


    <%

    if request.servervariables("Request_Method") = "POST" then

    stud_id = request.form("student_id")
    firstname = request.form("firstname")
    lastname = request.form("lastname")

    'checking for required fields
    if len(stud_id) < 9 then
    required = "student_id"
    elseif len(firstname) = 0 then
    required = "firstname"
    elseif len(lastname) = 0 then
    required = "lastname"
    end if

    if required <> "" then
    message = ucase(left(required,1)) & mid(required,2) & " is
    required"
    else
    'do processing
    end if

    end if
    if message <> "" then
    %>
    <script language="JavaScript" type="text/javascript">
    <!--
    alert('<%=message%>');
    //-->
    </script>
    <%
    message = "<div class=" & chr(034) & "message" & chr(034) & ">
    <strong>" & message & "</strong></div>"

    end if
    %>
    <head>
    <style type="text/css">
    ..message {font-weight:bold, color:#F00; text-align:center}
    </style>
    </head>
    <body>
    <%=message%>
    <form ....

    --
    Adrienne Boswell
    Please respond to the group so others can share
    http://www.cavalcade-of-coding.info
    Adrienne Boswell, Apr 6, 2006
    #2
    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:
    425
    Tommy
    Nov 29, 2003
  2. Sumith Mathur
    Replies:
    0
    Views:
    2,203
    Sumith Mathur
    Sep 23, 2004
  3. OriginalBrownster

    string validation/ form validation

    OriginalBrownster, Aug 21, 2006, in forum: Python
    Replies:
    1
    Views:
    421
    Simon Forman
    Aug 21, 2006
  4. Replies:
    7
    Views:
    621
  5. bnp
    Replies:
    4
    Views:
    320
Loading...

Share This Page