Validate form input (ASP)

X

xfile

Hi:

I spent a whole day trying to find a simple ASP code to validate two boxes
input.

All I got were java and ASP.NET and I've tried them but could not work here.

Can anyone please help? Here is what I got

The form is based on "ASP" and will deliver data and store into an Access
database - this part is ok.

If all fields have been filled out and submitted, it will link to a
confirmation page - this part is ok.

Upon submit, the form will first check if all the required input is being
filled out - this part is ok.

Problem is one more validation for two password boxes. The two passwords
have to match each other before the form is being processed.

What I have tried ---

(1) Scripts are either being ignored without processing for any validation,
or
(2) An error message jumped out saying the two passwords do not match each
other but the form still is being processed and the confirmation page still
be brought up.

I know there is a "validate" option box for text box but have no idea of how
to set up the last two options for the value. I could not find anywhere from
Microsoft about any explanations of the set up, neither for the ASP samples.
I found some from other sites but did not work.

Please show me or point me to where I can finish up these last validation.

PS: Kindly do let me know where should I put those scripts in the code
section if you do have them. I have spent tremendous efforts just by trying
putting scripts on the right place but seems far from success.

Thanks so much!!!I
 
P

Peter Aitken

xfile said:
Hi:

I spent a whole day trying to find a simple ASP code to validate two boxes
input.

All I got were java and ASP.NET and I've tried them but could not work here.

Can anyone please help? Here is what I got

<snipped>

You really have to post the page if you want people to diagnose it.
 
K

Kevin Spencer

It sounds like you're using FrontPage to create your validation script, by
setting properties of form fields, right? If so, FrontPage uses a special
WebBot to create the JavaScript that does the validation. As it is WebBot
code, you can't modify it without first removing the WebBot tags in the
code. After that, you won't be able to use the FrontPage tools to perform
validation any more, and you will be on your own.

To validate one textbox to match the value of another, you will not be able
to use any FrontPage validation. This is outside the typical validation
types and is not supported by FrontPage. You will have to modify your form
validation script by hand to check the value of one text box against
another.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
X

xfile

Hi:

Thanks for your advise.

I tried to use filed to validate but dropped it after I failed for many
times and could not find any information from MS.

The webbot, however, does process the form submission and database part
though.

The following is my codes, and I will post it in two parts: (1) The ASP page
of the form , and (2) Java scripts that I intended to insert into the ASP
page.

One more question - I also tried ASP.Net control from samples of MS and
seems it cannot coexist with ASP. In addition, I read somewhere during
research on the net, JavaScript also cannot coexist with ASP. And there are
other ActiveX, Vbasic and so on. In order to find the right codes to use,
what languages CAN coexist with ASP? My server does support ASP.NET, and if
I wish to use ASP.NET codes, does it mean that I have to re-generate the
whole page and remove ALL those generated by FP 2003?


------- Here are java codes - I tried them on a separate page and they
worked --------------------
<html>
<head>
<title>Login Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript">
<!--
function checkEntries(frm)
{
// Ensure something has been entered for a username
if (frm.un.value == "")
{
alert('You must provide a username to login');
frm.un.focus();
return false;
}
// Ensure something has been entered for a password
else if (frm.pw.value == "")
{
alert('You must provide a password to login');
frm.pw.focus();
return false;
}
// Ensure the password is at least six characters
else if (frm.pw.value.length < 6)
{
alert('The password must be at least six characters');
frm.pw.focus();
frm.pw.select();
return false;
}
// If the confirmation passowrd doesn't match the original password,
// show an error message, set focus back to the field, and
highlight the entry.
else if (frm.confpw.value != frm.pw.value)
{
alert('The confirmation password does not match the original
password');
frm.confpw.focus();
frm.confpw.select();
return false;
}
return true;
}
//-->
</script>
</head>
<body>
<h1>Login Details</h1
-----------------------------------------
Note: The part I wish to use is checking confirmation password against the
password starting from "else if (frm.confpw.value != frm.pw.value)...". I
changed "else if" to"if" as this is the only part to be use.. "frm" = form
name, "confpw" = field name.
----------------------------------------------------------------------------
------------------------------------------
The following is ASP codes - I took some option items and HTML text off to
save some space. Kindly tell me where should I put the above code in order
to work, if possibe at all.
----------------------------------------------------------------------------
-----------------------------------------------
<%
' FP_ASP ASP Automatically generated by a Frontpage Component. Do not Edit.

On Error Resume Next
Session("FP_OldCodePage") = Session.CodePage
Session("FP_OldLCID") = Session.LCID
Session.CodePage = 1252
Session.LCID = 1033
Err.Clear

strErrorUrl = ""

If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
If Request.Form("VTI-GROUP") = "0" Then
Err.Clear

Set fp_conn = Server.CreateObject("ADODB.Connection")
FP_DumpError strErrorUrl, "Cannot create connection"

Set fp_rs = Server.CreateObject("ADODB.Recordset")
FP_DumpError strErrorUrl, "Cannot create record set"

fp_conn.Open Application("Logon_ConnectionString")
FP_DumpError strErrorUrl, "Cannot open database"

fp_rs.Open "tb1Users", fp_conn, 1, 3, 2 ' adOpenKeySet, adLockOptimistic,
adCmdTable
FP_DumpError strErrorUrl, "Cannot open record set"

fp_rs.AddNew
FP_DumpError strErrorUrl, "Cannot add new record set to the database"
Dim arFormFields0(14)
Dim arFormDBFields0(14)
Dim arFormValues0(14)

arFormFields0(0) = "ConfirmPassword"
arFormDBFields0(0) = "ConfirmPWD"
arFormValues0(0) = Request("ConfirmPassword")
arFormFields0(1) = "Terms"
arFormDBFields0(1) = "AgreePolicy"
arFormValues0(1) = Request("Terms")
arFormFields0(2) = "Info_Shalom"
arFormDBFields0(2) = "Info_Shalom"
arFormValues0(2) = Request("Info_Shalom")
arFormFields0(3) = "Password"
arFormDBFields0(3) = "PWD"
arFormValues0(3) = Request("Password")
arFormFields0(4) = "JobTitle"
arFormDBFields0(4) = "JobTitle"
arFormValues0(4) = Request("JobTitle")
arFormFields0(5) = "industry"
arFormDBFields0(5) = "Industry"
arFormValues0(5) = Request("industry")
arFormFields0(6) = "UserName"
arFormDBFields0(6) = "UID"
arFormValues0(6) = Request("UserName")
arFormFields0(7) = "Email"
arFormDBFields0(7) = "Email"
arFormValues0(7) = Request("Email")
arFormFields0(8) = "FirstName"
arFormDBFields0(8) = "FirstName"
arFormValues0(8) = Request("FirstName")
arFormFields0(9) = "department"
arFormDBFields0(9) = "Department"
arFormValues0(9) = Request("department")
arFormFields0(10) = "Country"
arFormDBFields0(10) = "Country"
arFormValues0(10) = Request("Country")
arFormFields0(11) = "LastName"
arFormDBFields0(11) = "LastName"
arFormValues0(11) = Request("LastName")
arFormFields0(12) = "Info_Partner"
arFormDBFields0(12) = "Info_Partner"
arFormValues0(12) = Request("Info_Partner")
arFormFields0(13) = "CompanyName"
arFormDBFields0(13) = "Company"
arFormValues0(13) = Request("CompanyName")

FP_SaveFormFields fp_rs, arFormFields0, arFormDBFields0

If Request.ServerVariables("HTTP_USER_AGENT") <> "" Then
FP_SaveFieldToDB fp_rs, Request.ServerVariables("HTTP_USER_AGENT"),
"Browser_type1"
End If
If Request.ServerVariables("REMOTE_HOST") <> "" Then
FP_SaveFieldToDB fp_rs, Request.ServerVariables("REMOTE_HOST"),
"Remote_computer_name1"
End If
FP_SaveFieldToDB fp_rs, Now, "Timestamp1"
If Request.ServerVariables("REMOTE_USER") <> "" Then
FP_SaveFieldToDB fp_rs, Request.ServerVariables("REMOTE_USER"),
"User_name"
End If

fp_rs.Update
FP_DumpError strErrorUrl, "Cannot update the database"

fp_rs.Close
fp_conn.Close

Session("FP_SavedFields")=arFormFields0
Session("FP_SavedValues")=arFormValues0
Session.CodePage = Session("FP_OldCodePage")
Session.LCID = Session("FP_OldLCID")
Response.Redirect "Newsletter_Confirmation.asp"

End If
End If

Session.CodePage = Session("FP_OldCodePage")
Session.LCID = Session("FP_OldLCID")

%>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<title>SignUp Newsletter</title>
</head>

<body topmargin="0" leftmargin="0" bottommargin="0" rightmargin="0"
marginwidth="0" marginheight="0">

<table border="0" cellpadding="0" cellspacing="0" style="border-collapse:
collapse" bordercolor="#111111" width="770" id="AutoNumber1">
<tr>
<td width="765">
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" width="100%"
id="AutoNumber2">
<tr>
<td width="100%">
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" width="100%"
id="AutoNumber3">
<tr>
<td width="550" class="blank" valign="top">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.ca
b#version=6,0,0,0" width="550" height="91" id="flash_main1" align>
<param name="movie" value="flash_main1.swf">
<param name="quality" value="high">
<param name="bgcolor" value="#FFFFFF">
<embed src="flash_main1.swf" quality="high" bgcolor="#FFFFFF"
width="550" height="91" name="flash_main1" align
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer">

</embed>
</object>
</td>
<td width="215" align="center">
<!--webbot bot="Include" u-include="include_logo.htm"
tag="BODY" --></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%">
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" width="100%"
id="AutoNumber4">
<tr>
<td background="images/topbar_back.gif" width="35">&nbsp;</td>
<td background="images/topbar_back.gif" width="439">
<!--webbot bot="Include" u-include="include_globalmenu.htm"
tag="BODY" --></td>
<td background="images/topbar_back.gif" width="310"
align="right">
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" id="AutoNumber16">
<tr>
<td align="center" width="28">
&nbsp;</td>
<td align="center" width="28">
&nbsp;</td>
<td align="center" width="28">
&nbsp;</td>
<td align="center" width="28">
&nbsp;</td>
<td align="center" width="28">
&nbsp;</td>
<td align="center" width="28">
<a title="Sign Up Newsletter" href="Sign_Up_News.htm">
<img border="0" src="images/icon05.gif" width="24"
height="25"></a></td>
<td align="center" width="28">
<a title="Member Sign In" href="Test/SignIn.htm">
<img border="0" src="images/icon09.gif" width="24"
height="25" alt="Member Sign In"></a></td>
<td align="center" width="10">&nbsp;</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%" class="blank" background="images/topbar2_back.gif"
height="5">&nbsp;</td>
</tr>
<tr>
<td width="100%">&nbsp;</td>
</tr>
<tr>
<td width="100%">
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" width="100%"
id="AutoNumber17">
<tr>
<td valign="top" width="10">&nbsp;</td>
<td valign="top" width="190">
<table border="0" cellpadding="10" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" width="100%"
id="AutoNumber19">
<tr>
<td width="100%">
<p align="center">
<img border="0" src="images/Library.jpg" width="113"
height="117"></p>
</td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" width="100%"
id="AutoNumber20" height="583">
<tr>
<td width="100%" valign="top" rowspan="3">&nbsp;<form
method="POST" action="--WEBBOT-SELF--" name="Sing_Up_Newsletter">
<!--webbot bot="SaveDatabase" SuggestedExt="asp"
S-DataConnection="Logon" S-RecordSource="tb1Users"
U-Database-URL="_private/logon.mdb" S-Form-Fields="ConfirmPassword Terms
Info_Shalom Password JobTitle industry UserName Email FirstName department
Country LastName Info_Partner CompanyName" S-Form-DBFields="ConfirmPWD
AgreePolicy Info_Shalom PWD JobTitle Industry UID Email FirstName Department
Country LastName Info_Partner Company"
U-ASP-Include-Url="_fpclass/fpdbform.inc" startspan
S-Builtin-Fields="HTTP_USER_AGENT REMOTE_HOST Timestamp REMOTE_USER"
S-Builtin-DBFields="Browser_type1 Remote_computer_name1 Timestamp1
User_name" U-Confirmation-Url="Newsletter_Confirmation.asp" --><input
TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--#include
file="_fpclass/fpdbform.inc"--><!--webbot bot="SaveDatabase" endspan
i-checksum="40548" -->
<table border="0" width="100%" id="table1">
<tr>
<td width="147" align="right">User Name:</td>
<td><input type="text" name="UserName" size="20"></td>
<td width="4">&nbsp;</td>
</tr>
<tr>
<td width="147" align="right">Password:</td>
<td><input type="password" name="Password"
size="20"></td>
<td width="4">&nbsp;</td>
</tr>
<tr>
<td width="147" align="right">Confirm Password:</td>
<td>
<input type="password" name="ConfirmPassword"
size="20"></td>
<td width="4">&nbsp;</td>
</tr>
<tr>
<td width="147">
<p align="right">Email:</td>
<td><input type="text" name="Email" size="20"></td>
<td width="4">&nbsp;</td>
</tr>
<tr>
<td width="147">
<p align="right">First Name:</td>
<td><input type="text" name="FirstName"
size="20"></td>
<td width="4">&nbsp;</td>
</tr>
<tr>
<td width="147">
<p align="right">Last Name:</td>
<td><input type="text" name="LastName" size="20"></td>
<td width="4">&nbsp;</td>
</tr>
<tr>
<td width="147">
<p align="right">Job Title:</td>
<td><input type="text" name="JobTitle" size="20"></td>
<td width="4">&nbsp;</td>
</tr>
<tr>
<td width="147">
<p align="right">Company Name:</td>
<td><input type="text" name="CompanyName"
size="20"></td>
<td width="4">&nbsp;</td>
</tr>
<tr>
<td width="147">
<p align="right">Department:</td>
<td><SELECT name="department" size="1"><option
value="" SELECTED >-- Select your department --
<option value............
</select></td>
<td width="4">&nbsp;</td>
</tr>
<tr>
<td width="147">
<p align="right">Industry:</td>
<td><select name="industry" size="1">
<option value......
</select></td>
<td width="4">&nbsp;</td>
</tr>
<tr>
<td width="147">
<p align="right">Country:</td>
<td><select name="Country" size="1">
<option value=.......
</select></td>
<td width="4">&nbsp;</td>
</tr>
<tr>
<td width="147">&nbsp;</td>
<td>&nbsp;</td>
<td width="4">&nbsp;</td>
</tr>
</table>
<table border="0" width="100%" id="table2">
<tr>
<td width="60">
<p align="right">
<select size="1" name="Info_Shalom">
<option value="Yes" selected>Yes</option>
<option value="No">No</option>
</select><br>
&nbsp;</td>
<td>I wish to receive updated industry and service
information from Shalom International Consulting.</td>
<td width="4">&nbsp;</td>
</tr>
<tr>
<td width="60">
<p align="right">
<select size="1" name="Info_Partner">
<option value="Yes">Yes</option>
<option selected value="No">No</option>
</select><br>
&nbsp;</td>
<td>I wish to receive promotional information from
carefully selected business partners.</td>
<td width="4">&nbsp;</td>
</tr>
<tr>
<td width="60">
<p align="right">
<select size="1" name="Terms">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select><br>
&nbsp;</td>
<td>I have read and agree terms of use and privacy
policy.</td>
<td width="4">&nbsp;</td>
</tr>
<tr>
<td width="60">&nbsp;</td>
<td><br>
<input type="submit" value="Submit"
name="Submit"><input type="reset" value="Reset" name="Reset"></td>
<td width="4">&nbsp;</td>
</tr>
</table>
<p>&nbsp;</p>
</form>
</td>
<td height="37">
&nbsp;</td>
</tr>
<tr>
<td height="140">
<img border="0" src="images/image0.jpg" width="100"
height="140"></td>
</tr>
<tr>
<td height="406">
&nbsp;</td>
</tr>
</table>
<p>
<br>
</td>
<td valign="top" width="10">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%" background="images/topbar_back.gif" align="center">
<!--webbot bot="Include" u-include="include_globalmenu.htm"
tag="BODY" --></td>
</tr>
<tr>
<td width="100%" align="center" height="30">
<!--webbot bot="Include" u-include="include_copyright.htm"
tag="BODY" --></td>
</tr>
</table>
</td>
<td width="5" background="images/shadow_right.gif">&nbsp;</td>
</tr>
<tr>
<td class="blank" height="10"
background="images/shadow_bottom.gif">&nbsp;</td>
<td class="blank" height="10">
<img border="0" src="images/shadow_corner.gif" width="5"
height="10"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>

</body>

</html>
 
X

xfile

Sorry for the java script, i missed a few lines for the HTML part

<form id="loginDetails" name="loginDetails" method="post"
action="login.asp" onsubmit="return checkEntries(this)">
<p>
Username: <br>
<input type="text" size="40" value="" name="un"><br>
Password: <br>
<input type="password" size="40" value="" name="pw"><br>
Confirm Password: <br>
<input type="password" size="40" value="" name="confpw"><br>
<input type="submit" value="Login" name="loginButton">
</p>
</form>
</body>
</html>



xfile said:
Hi:

Thanks for your advise.

I tried to use filed to validate but dropped it after I failed for many
times and could not find any information from MS.

The webbot, however, does process the form submission and database part
though.

The following is my codes, and I will post it in two parts: (1) The ASP page
of the form , and (2) Java scripts that I intended to insert into the ASP
page.

One more question - I also tried ASP.Net control from samples of MS and
seems it cannot coexist with ASP. In addition, I read somewhere during
research on the net, JavaScript also cannot coexist with ASP. And there are
other ActiveX, Vbasic and so on. In order to find the right codes to use,
what languages CAN coexist with ASP? My server does support ASP.NET, and if
I wish to use ASP.NET codes, does it mean that I have to re-generate the
whole page and remove ALL those generated by FP 2003?


------- Here are java codes - I tried them on a separate page and they
worked --------------------
<html>
<head>
<title>Login Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript">
<!--
function checkEntries(frm)
{
// Ensure something has been entered for a username
if (frm.un.value == "")
{
alert('You must provide a username to login');
frm.un.focus();
return false;
}
// Ensure something has been entered for a password
else if (frm.pw.value == "")
{
alert('You must provide a password to login');
frm.pw.focus();
return false;
}
// Ensure the password is at least six characters
else if (frm.pw.value.length < 6)
{
alert('The password must be at least six characters');
frm.pw.focus();
frm.pw.select();
return false;
}
// If the confirmation passowrd doesn't match the original password,
// show an error message, set focus back to the field, and
highlight the entry.
else if (frm.confpw.value != frm.pw.value)
{
alert('The confirmation password does not match the original
password');
frm.confpw.focus();
frm.confpw.select();
return false;
}
return true;
}
//-->
</script>
</head>
<body>
<h1>Login Details</h1
-----------------------------------------
Note: The part I wish to use is checking confirmation password against the
password starting from "else if (frm.confpw.value != frm.pw.value)...". I
changed "else if" to"if" as this is the only part to be use.. "frm" = form
name, "confpw" = field name.
-------------------------------------------------------------------------- --
------------------------------------------
The following is ASP codes - I took some option items and HTML text off to
save some space. Kindly tell me where should I put the above code in order
to work, if possibe at all.
-------------------------------------------------------------------------- --
-----------------------------------------------
<%
' FP_ASP ASP Automatically generated by a Frontpage Component. Do not Edit.

On Error Resume Next
Session("FP_OldCodePage") = Session.CodePage
Session("FP_OldLCID") = Session.LCID
Session.CodePage = 1252
Session.LCID = 1033
Err.Clear

strErrorUrl = ""

If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
If Request.Form("VTI-GROUP") = "0" Then
Err.Clear

Set fp_conn = Server.CreateObject("ADODB.Connection")
FP_DumpError strErrorUrl, "Cannot create connection"

Set fp_rs = Server.CreateObject("ADODB.Recordset")
FP_DumpError strErrorUrl, "Cannot create record set"

fp_conn.Open Application("Logon_ConnectionString")
FP_DumpError strErrorUrl, "Cannot open database"

fp_rs.Open "tb1Users", fp_conn, 1, 3, 2 ' adOpenKeySet, adLockOptimistic,
adCmdTable
FP_DumpError strErrorUrl, "Cannot open record set"

fp_rs.AddNew
FP_DumpError strErrorUrl, "Cannot add new record set to the database"
Dim arFormFields0(14)
Dim arFormDBFields0(14)
Dim arFormValues0(14)

arFormFields0(0) = "ConfirmPassword"
arFormDBFields0(0) = "ConfirmPWD"
arFormValues0(0) = Request("ConfirmPassword")
arFormFields0(1) = "Terms"
arFormDBFields0(1) = "AgreePolicy"
arFormValues0(1) = Request("Terms")
arFormFields0(2) = "Info_Shalom"
arFormDBFields0(2) = "Info_Shalom"
arFormValues0(2) = Request("Info_Shalom")
arFormFields0(3) = "Password"
arFormDBFields0(3) = "PWD"
arFormValues0(3) = Request("Password")
arFormFields0(4) = "JobTitle"
arFormDBFields0(4) = "JobTitle"
arFormValues0(4) = Request("JobTitle")
arFormFields0(5) = "industry"
arFormDBFields0(5) = "Industry"
arFormValues0(5) = Request("industry")
arFormFields0(6) = "UserName"
arFormDBFields0(6) = "UID"
arFormValues0(6) = Request("UserName")
arFormFields0(7) = "Email"
arFormDBFields0(7) = "Email"
arFormValues0(7) = Request("Email")
arFormFields0(8) = "FirstName"
arFormDBFields0(8) = "FirstName"
arFormValues0(8) = Request("FirstName")
arFormFields0(9) = "department"
arFormDBFields0(9) = "Department"
arFormValues0(9) = Request("department")
arFormFields0(10) = "Country"
arFormDBFields0(10) = "Country"
arFormValues0(10) = Request("Country")
arFormFields0(11) = "LastName"
arFormDBFields0(11) = "LastName"
arFormValues0(11) = Request("LastName")
arFormFields0(12) = "Info_Partner"
arFormDBFields0(12) = "Info_Partner"
arFormValues0(12) = Request("Info_Partner")
arFormFields0(13) = "CompanyName"
arFormDBFields0(13) = "Company"
arFormValues0(13) = Request("CompanyName")

FP_SaveFormFields fp_rs, arFormFields0, arFormDBFields0

If Request.ServerVariables("HTTP_USER_AGENT") <> "" Then
FP_SaveFieldToDB fp_rs, Request.ServerVariables("HTTP_USER_AGENT"),
"Browser_type1"
End If
If Request.ServerVariables("REMOTE_HOST") <> "" Then
FP_SaveFieldToDB fp_rs, Request.ServerVariables("REMOTE_HOST"),
"Remote_computer_name1"
End If
FP_SaveFieldToDB fp_rs, Now, "Timestamp1"
If Request.ServerVariables("REMOTE_USER") <> "" Then
FP_SaveFieldToDB fp_rs, Request.ServerVariables("REMOTE_USER"),
"User_name"
End If

fp_rs.Update
FP_DumpError strErrorUrl, "Cannot update the database"

fp_rs.Close
fp_conn.Close

Session("FP_SavedFields")=arFormFields0
Session("FP_SavedValues")=arFormValues0
Session.CodePage = Session("FP_OldCodePage")
Session.LCID = Session("FP_OldLCID")
Response.Redirect "Newsletter_Confirmation.asp"

End If
End If

Session.CodePage = Session("FP_OldCodePage")
Session.LCID = Session("FP_OldLCID")

%>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<title>SignUp Newsletter</title>
</head>

<body topmargin="0" leftmargin="0" bottommargin="0" rightmargin="0"
marginwidth="0" marginheight="0">

<table border="0" cellpadding="0" cellspacing="0" style="border-collapse:
collapse" bordercolor="#111111" width="770" id="AutoNumber1">
<tr>
<td width="765">
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" width="100%"
id="AutoNumber2">
<tr>
<td width="100%">
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" width="100%"
id="AutoNumber3">
<tr>
<td width="550" class="blank" valign="top">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.ca
b#version=6,0,0,0" width="550" height="91" id="flash_main1" align>
<param name="movie" value="flash_main1.swf">
<param name="quality" value="high">
<param name="bgcolor" value="#FFFFFF">
<embed src="flash_main1.swf" quality="high" bgcolor="#FFFFFF"
width="550" height="91" name="flash_main1" align
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer">

</embed>
</object>
</td>
<td width="215" align="center">
<!--webbot bot="Include" u-include="include_logo.htm"
tag="BODY" --></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%">
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" width="100%"
id="AutoNumber4">
<tr>
<td background="images/topbar_back.gif" width="35">&nbsp;</td>
<td background="images/topbar_back.gif" width="439">
<!--webbot bot="Include" u-include="include_globalmenu.htm"
tag="BODY" --></td>
<td background="images/topbar_back.gif" width="310"
align="right">
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" id="AutoNumber16">
<tr>
<td align="center" width="28">
&nbsp;</td>
<td align="center" width="28">
&nbsp;</td>
<td align="center" width="28">
&nbsp;</td>
<td align="center" width="28">
&nbsp;</td>
<td align="center" width="28">
&nbsp;</td>
<td align="center" width="28">
<a title="Sign Up Newsletter" href="Sign_Up_News.htm">
<img border="0" src="images/icon05.gif" width="24"
height="25"></a></td>
<td align="center" width="28">
<a title="Member Sign In" href="Test/SignIn.htm">
<img border="0" src="images/icon09.gif" width="24"
height="25" alt="Member Sign In"></a></td>
<td align="center" width="10">&nbsp;</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%" class="blank" background="images/topbar2_back.gif"
height="5">&nbsp;</td>
</tr>
<tr>
<td width="100%">&nbsp;</td>
</tr>
<tr>
<td width="100%">
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" width="100%"
id="AutoNumber17">
<tr>
<td valign="top" width="10">&nbsp;</td>
<td valign="top" width="190">
<table border="0" cellpadding="10" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" width="100%"
id="AutoNumber19">
<tr>
<td width="100%">
<p align="center">
<img border="0" src="images/Library.jpg" width="113"
height="117"></p>
</td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" width="100%"
id="AutoNumber20" height="583">
<tr>
<td width="100%" valign="top" rowspan="3">&nbsp;<form
method="POST" action="--WEBBOT-SELF--" name="Sing_Up_Newsletter">
<!--webbot bot="SaveDatabase" SuggestedExt="asp"
S-DataConnection="Logon" S-RecordSource="tb1Users"
U-Database-URL="_private/logon.mdb" S-Form-Fields="ConfirmPassword Terms
Info_Shalom Password JobTitle industry UserName Email FirstName department
Country LastName Info_Partner CompanyName" S-Form-DBFields="ConfirmPWD
AgreePolicy Info_Shalom PWD JobTitle Industry UID Email FirstName Department
Country LastName Info_Partner Company"
U-ASP-Include-Url="_fpclass/fpdbform.inc" startspan
S-Builtin-Fields="HTTP_USER_AGENT REMOTE_HOST Timestamp REMOTE_USER"
S-Builtin-DBFields="Browser_type1 Remote_computer_name1 Timestamp1
User_name" U-Confirmation-Url="Newsletter_Confirmation.asp" --><input
TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--#include
file="_fpclass/fpdbform.inc"--><!--webbot bot="SaveDatabase" endspan
i-checksum="40548" -->
<table border="0" width="100%" id="table1">
<tr>
<td width="147" align="right">User Name:</td>
<td><input type="text" name="UserName"
size="20"> said:
<td width="4">&nbsp;</td>
</tr>
<tr>
<td width="147" align="right">Password:</td>
<td><input type="password" name="Password"
size="20"></td>
<td width="4">&nbsp;</td>
</tr>
<tr>
<td width="147" align="right">Confirm Password:</td>
<td>
<input type="password" name="ConfirmPassword"
size="20"></td>
<td width="4">&nbsp;</td>
</tr>
<tr>
<td width="147">
<p align="right">Email:</td>
<td><input type="text" name="Email" size="20"></td>
<td width="4">&nbsp;</td>
</tr>
<tr>
<td width="147">
<p align="right">First Name:</td>
<td><input type="text" name="FirstName"
size="20"></td>
<td width="4">&nbsp;</td>
</tr>
<tr>
<td width="147">
<p align="right">Last Name:</td>
<td><input type="text" name="LastName"
size="20"> said:
<td width="4">&nbsp;</td>
</tr>
<tr>
<td width="147">
<p align="right">Job Title:</td>
<td><input type="text" name="JobTitle"
 
K

Kevin Spencer

One more question - I also tried ASP.Net control from samples of MS and
seems it cannot coexist with ASP. In addition, I read somewhere during
research on the net, JavaScript also cannot coexist with ASP. And there are
other ActiveX, Vbasic and so on. In order to find the right codes to use,
what languages CAN coexist with ASP? My server does support ASP.NET, and if
I wish to use ASP.NET codes, does it mean that I have to re-generate the
whole page and remove ALL those generated by FP 2003?

Programming is not guesswork. You need to understand each of these
technologies, at least somewhat, before trying to use them. Yes, it's a lot
of work. I've been there. I still am. I spend several hours a day doing
research to improve my understanding of the technologies I work with. There
are no short cuts.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

xfile said:
Hi:

Thanks for your advise.

I tried to use filed to validate but dropped it after I failed for many
times and could not find any information from MS.

The webbot, however, does process the form submission and database part
though.

The following is my codes, and I will post it in two parts: (1) The ASP page
of the form , and (2) Java scripts that I intended to insert into the ASP
page.

One more question - I also tried ASP.Net control from samples of MS and
seems it cannot coexist with ASP. In addition, I read somewhere during
research on the net, JavaScript also cannot coexist with ASP. And there are
other ActiveX, Vbasic and so on. In order to find the right codes to use,
what languages CAN coexist with ASP? My server does support ASP.NET, and if
I wish to use ASP.NET codes, does it mean that I have to re-generate the
whole page and remove ALL those generated by FP 2003?


------- Here are java codes - I tried them on a separate page and they
worked --------------------
<html>
<head>
<title>Login Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript">
<!--
function checkEntries(frm)
{
// Ensure something has been entered for a username
if (frm.un.value == "")
{
alert('You must provide a username to login');
frm.un.focus();
return false;
}
// Ensure something has been entered for a password
else if (frm.pw.value == "")
{
alert('You must provide a password to login');
frm.pw.focus();
return false;
}
// Ensure the password is at least six characters
else if (frm.pw.value.length < 6)
{
alert('The password must be at least six characters');
frm.pw.focus();
frm.pw.select();
return false;
}
// If the confirmation passowrd doesn't match the original password,
// show an error message, set focus back to the field, and
highlight the entry.
else if (frm.confpw.value != frm.pw.value)
{
alert('The confirmation password does not match the original
password');
frm.confpw.focus();
frm.confpw.select();
return false;
}
return true;
}
//-->
</script>
</head>
<body>
<h1>Login Details</h1
-----------------------------------------
Note: The part I wish to use is checking confirmation password against the
password starting from "else if (frm.confpw.value != frm.pw.value)...". I
changed "else if" to"if" as this is the only part to be use.. "frm" = form
name, "confpw" = field name.
-------------------------------------------------------------------------- --
------------------------------------------
The following is ASP codes - I took some option items and HTML text off to
save some space. Kindly tell me where should I put the above code in order
to work, if possibe at all.
-------------------------------------------------------------------------- --
-----------------------------------------------
<%
' FP_ASP ASP Automatically generated by a Frontpage Component. Do not Edit.

On Error Resume Next
Session("FP_OldCodePage") = Session.CodePage
Session("FP_OldLCID") = Session.LCID
Session.CodePage = 1252
Session.LCID = 1033
Err.Clear

strErrorUrl = ""

If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
If Request.Form("VTI-GROUP") = "0" Then
Err.Clear

Set fp_conn = Server.CreateObject("ADODB.Connection")
FP_DumpError strErrorUrl, "Cannot create connection"

Set fp_rs = Server.CreateObject("ADODB.Recordset")
FP_DumpError strErrorUrl, "Cannot create record set"

fp_conn.Open Application("Logon_ConnectionString")
FP_DumpError strErrorUrl, "Cannot open database"

fp_rs.Open "tb1Users", fp_conn, 1, 3, 2 ' adOpenKeySet, adLockOptimistic,
adCmdTable
FP_DumpError strErrorUrl, "Cannot open record set"

fp_rs.AddNew
FP_DumpError strErrorUrl, "Cannot add new record set to the database"
Dim arFormFields0(14)
Dim arFormDBFields0(14)
Dim arFormValues0(14)

arFormFields0(0) = "ConfirmPassword"
arFormDBFields0(0) = "ConfirmPWD"
arFormValues0(0) = Request("ConfirmPassword")
arFormFields0(1) = "Terms"
arFormDBFields0(1) = "AgreePolicy"
arFormValues0(1) = Request("Terms")
arFormFields0(2) = "Info_Shalom"
arFormDBFields0(2) = "Info_Shalom"
arFormValues0(2) = Request("Info_Shalom")
arFormFields0(3) = "Password"
arFormDBFields0(3) = "PWD"
arFormValues0(3) = Request("Password")
arFormFields0(4) = "JobTitle"
arFormDBFields0(4) = "JobTitle"
arFormValues0(4) = Request("JobTitle")
arFormFields0(5) = "industry"
arFormDBFields0(5) = "Industry"
arFormValues0(5) = Request("industry")
arFormFields0(6) = "UserName"
arFormDBFields0(6) = "UID"
arFormValues0(6) = Request("UserName")
arFormFields0(7) = "Email"
arFormDBFields0(7) = "Email"
arFormValues0(7) = Request("Email")
arFormFields0(8) = "FirstName"
arFormDBFields0(8) = "FirstName"
arFormValues0(8) = Request("FirstName")
arFormFields0(9) = "department"
arFormDBFields0(9) = "Department"
arFormValues0(9) = Request("department")
arFormFields0(10) = "Country"
arFormDBFields0(10) = "Country"
arFormValues0(10) = Request("Country")
arFormFields0(11) = "LastName"
arFormDBFields0(11) = "LastName"
arFormValues0(11) = Request("LastName")
arFormFields0(12) = "Info_Partner"
arFormDBFields0(12) = "Info_Partner"
arFormValues0(12) = Request("Info_Partner")
arFormFields0(13) = "CompanyName"
arFormDBFields0(13) = "Company"
arFormValues0(13) = Request("CompanyName")

FP_SaveFormFields fp_rs, arFormFields0, arFormDBFields0

If Request.ServerVariables("HTTP_USER_AGENT") <> "" Then
FP_SaveFieldToDB fp_rs, Request.ServerVariables("HTTP_USER_AGENT"),
"Browser_type1"
End If
If Request.ServerVariables("REMOTE_HOST") <> "" Then
FP_SaveFieldToDB fp_rs, Request.ServerVariables("REMOTE_HOST"),
"Remote_computer_name1"
End If
FP_SaveFieldToDB fp_rs, Now, "Timestamp1"
If Request.ServerVariables("REMOTE_USER") <> "" Then
FP_SaveFieldToDB fp_rs, Request.ServerVariables("REMOTE_USER"),
"User_name"
End If

fp_rs.Update
FP_DumpError strErrorUrl, "Cannot update the database"

fp_rs.Close
fp_conn.Close

Session("FP_SavedFields")=arFormFields0
Session("FP_SavedValues")=arFormValues0
Session.CodePage = Session("FP_OldCodePage")
Session.LCID = Session("FP_OldLCID")
Response.Redirect "Newsletter_Confirmation.asp"

End If
End If

Session.CodePage = Session("FP_OldCodePage")
Session.LCID = Session("FP_OldLCID")

%>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<title>SignUp Newsletter</title>
</head>

<body topmargin="0" leftmargin="0" bottommargin="0" rightmargin="0"
marginwidth="0" marginheight="0">

<table border="0" cellpadding="0" cellspacing="0" style="border-collapse:
collapse" bordercolor="#111111" width="770" id="AutoNumber1">
<tr>
<td width="765">
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" width="100%"
id="AutoNumber2">
<tr>
<td width="100%">
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" width="100%"
id="AutoNumber3">
<tr>
<td width="550" class="blank" valign="top">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.ca
b#version=6,0,0,0" width="550" height="91" id="flash_main1" align>
<param name="movie" value="flash_main1.swf">
<param name="quality" value="high">
<param name="bgcolor" value="#FFFFFF">
<embed src="flash_main1.swf" quality="high" bgcolor="#FFFFFF"
width="550" height="91" name="flash_main1" align
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer">

</embed>
</object>
</td>
<td width="215" align="center">
<!--webbot bot="Include" u-include="include_logo.htm"
tag="BODY" --></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%">
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" width="100%"
id="AutoNumber4">
<tr>
<td background="images/topbar_back.gif" width="35">&nbsp;</td>
<td background="images/topbar_back.gif" width="439">
<!--webbot bot="Include" u-include="include_globalmenu.htm"
tag="BODY" --></td>
<td background="images/topbar_back.gif" width="310"
align="right">
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" id="AutoNumber16">
<tr>
<td align="center" width="28">
&nbsp;</td>
<td align="center" width="28">
&nbsp;</td>
<td align="center" width="28">
&nbsp;</td>
<td align="center" width="28">
&nbsp;</td>
<td align="center" width="28">
&nbsp;</td>
<td align="center" width="28">
<a title="Sign Up Newsletter" href="Sign_Up_News.htm">
<img border="0" src="images/icon05.gif" width="24"
height="25"></a></td>
<td align="center" width="28">
<a title="Member Sign In" href="Test/SignIn.htm">
<img border="0" src="images/icon09.gif" width="24"
height="25" alt="Member Sign In"></a></td>
<td align="center" width="10">&nbsp;</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%" class="blank" background="images/topbar2_back.gif"
height="5">&nbsp;</td>
</tr>
<tr>
<td width="100%">&nbsp;</td>
</tr>
<tr>
<td width="100%">
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" width="100%"
id="AutoNumber17">
<tr>
<td valign="top" width="10">&nbsp;</td>
<td valign="top" width="190">
<table border="0" cellpadding="10" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" width="100%"
id="AutoNumber19">
<tr>
<td width="100%">
<p align="center">
<img border="0" src="images/Library.jpg" width="113"
height="117"></p>
</td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" width="100%"
id="AutoNumber20" height="583">
<tr>
<td width="100%" valign="top" rowspan="3">&nbsp;<form
method="POST" action="--WEBBOT-SELF--" name="Sing_Up_Newsletter">
<!--webbot bot="SaveDatabase" SuggestedExt="asp"
S-DataConnection="Logon" S-RecordSource="tb1Users"
U-Database-URL="_private/logon.mdb" S-Form-Fields="ConfirmPassword Terms
Info_Shalom Password JobTitle industry UserName Email FirstName department
Country LastName Info_Partner CompanyName" S-Form-DBFields="ConfirmPWD
AgreePolicy Info_Shalom PWD JobTitle Industry UID Email FirstName Department
Country LastName Info_Partner Company"
U-ASP-Include-Url="_fpclass/fpdbform.inc" startspan
S-Builtin-Fields="HTTP_USER_AGENT REMOTE_HOST Timestamp REMOTE_USER"
S-Builtin-DBFields="Browser_type1 Remote_computer_name1 Timestamp1
User_name" U-Confirmation-Url="Newsletter_Confirmation.asp" --><input
TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--#include
file="_fpclass/fpdbform.inc"--><!--webbot bot="SaveDatabase" endspan
i-checksum="40548" -->
<table border="0" width="100%" id="table1">
<tr>
<td width="147" align="right">User Name:</td>
<td><input type="text" name="UserName"
size="20"> said:
<td width="4">&nbsp;</td>
</tr>
<tr>
<td width="147" align="right">Password:</td>
<td><input type="password" name="Password"
size="20"></td>
<td width="4">&nbsp;</td>
</tr>
<tr>
<td width="147" align="right">Confirm Password:</td>
<td>
<input type="password" name="ConfirmPassword"
size="20"></td>
<td width="4">&nbsp;</td>
</tr>
<tr>
<td width="147">
<p align="right">Email:</td>
<td><input type="text" name="Email" size="20"></td>
<td width="4">&nbsp;</td>
</tr>
<tr>
<td width="147">
<p align="right">First Name:</td>
<td><input type="text" name="FirstName"
size="20"></td>
<td width="4">&nbsp;</td>
</tr>
<tr>
<td width="147">
<p align="right">Last Name:</td>
<td><input type="text" name="LastName"
size="20"> said:
<td width="4">&nbsp;</td>
</tr>
<tr>
<td width="147">
<p align="right">Job Title:</td>
<td><input type="text" name="JobTitle"
 
X

xfile

Hi:

Thanks for sharing and I do understand that very well.

I am not a technical person in the first place although I have been involved
in the industry for over a decade.

I just started up my own business recently and have very limited resources
so I decided to play the role for a while until things are settled down.

No professional is a guesswork and the only difference is priority and
resources allocations. At this time, I just don't have enough time and
resources either to recruit one or become a one.

Thanks again for the sharing and all pointed are very well noted.
 
X

xfile

Hi:

Really appreciate your kind help and I will follow the step-by-step
instructions.

Maybe I don't even know how to use proper terms to search in MS
Knowledgebase.

Again, thank you so much for your kind sharing.
 

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

Top