By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,203 Members | 1,549 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,203 IT Pros & Developers. It's quick & easy.

Validation Of ASP Form HELP URGENT

P: n/a
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

Apr 6 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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
Apr 6 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.