Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Validation Of ASP Form HELP URGENT

Reply
Thread Tools

Validation Of ASP Form HELP URGENT

 
 
SpiderSwamy
Guest
Posts: n/a
 
      04-06-2006
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

 
Reply With Quote
 
 
 
 
Adrienne Boswell
Guest
Posts: n/a
 
      04-06-2006
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
urgent help....need urgent help on say string task.. pooja Software 0 03-03-2009 06:16 AM
javascript form validation - form action to another asp page iam247@gmail.com ASP General 7 08-20-2005 10:06 PM
copy and paste form RTF document into field in asp form cause it to bypass field length and javascript validation - how to overcome? NotGiven Javascript 3 05-13-2004 12:15 AM
copy and paste form RTF document into field in asp form cause it to bypass field length and javascript validation - how to overcome? NotGiven ASP General 3 05-13-2004 12:15 AM
Form Validation Problem...Persisiting form fields on validation failure. bnp Javascript 4 05-12-2004 12:16 PM



Advertisments