Validation Of ASP Form HELP URGENT

S

SpiderSwamy

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
 
A

Adrienne Boswell

Gazing into my crystal ball I observed "SpiderSwamy" <manju_016
@rediffmail.com> writing in @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 ....
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top