Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 If...then..Else
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

asp_storm
Average Member

USA
787 Posts

Posted - 12 July 2001 :  20:39:53  Show Profile  Visit asp_storm's Homepage  Send asp_storm an AOL message
Ok, i made a SIMPLE script where people enter their name,
and i need help making a if statement to check and see if the user has
entered a name, instead of leaving it blank. I am just learning how to code,
and forgot how to do IF statements.




Edited by - asp_newbie on 12 July 2001 20:48:07

mafifi
Junior Member

USA
308 Posts

Posted - 12 July 2001 :  21:11:36  Show Profile  Send mafifi an ICQ Message
This is how you do it in Java Script
 
<script Language="JavaScript"><!--
function FrontPage_Form1_Validator(theForm)
{

if (theForm.FirstName.value == "")
{
alert("Please enter a value for the \"First Name\" field.");
theForm.FirstName.focus();
return (false);
}
return (true);
}
//--></script>



<form method="POST" action="InsertGuestBookEntry.asp" onsubmit="return FrontPage_Form1_Validator(this)" name="FrontPage_Form1">




Thanks,

Mo

Edited by - mafifi on 12 July 2001 21:14:25

Edited by - mafifi on 12 July 2001 21:16:27
Go to Top of Page

asp_storm
Average Member

USA
787 Posts

Posted - 12 July 2001 :  22:24:37  Show Profile  Visit asp_storm's Homepage  Send asp_storm an AOL message
k, thanks
Go to Top of Page

Spoon
Average Member

Ireland
507 Posts

Posted - 13 July 2001 :  18:16:30  Show Profile  Visit Spoon's Homepage  Send Spoon an ICQ Message
if you are sending the form off to an asp page you can use this, otherwise stick with the Javascipt!!

Your textfield is called NAME


<%
Dim NAME
NAME = Request.Form("NAME")
If NAME = "" Then
Response.Write "You Must Enter A Name"
Response.End
End If
%>


Thats it!

Regards,

Spoon



"uohh look at me, ive got a signature, uohh look at me!" :)

Edited by - spoon on 13 July 2001 18:18:00
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.33 seconds. Powered By: Snitz Forums 2000 Version 3.4.07