Ask a Question related to Dreamweaver AppDev, Design and Development.
-
green_zipper #1
After submit of a form
I want to allow software to be donwloaded but only after a form is filled out ,
verified and submitted. No matter where I place the code it does not call the
next page that will perfom the donwload. Any help would be great.
green_zipper Guest
-
Form does not submit in Mac
Hi all, I am using the submitForm() on my submit button. I have set the URL to "/Save.aspx" which will get the submitted information and doing... -
Need Help With Submit Form
I have DW 3 and designing my own site. I would like my customer to be able to fill out a form. I know how to create a form, I don't know how to get... -
Form submit
Mira, If you move from one page to another then the objects which were on the first page wouldn't be accessible from the second. Is this what... -
Form Field/ Form Submit Problems (probably an easy answer...)
Hey Everyone.. I have a form that has approximately 7 text fields and 1 checkbox. Generally when this form is submitted(to itself BTW) it works... -
ASP Form Doesn't Always Submit
Hello everyone, I am pretty much newbie to ASP so please bear with me as I explain my problem. I currently have a main form which displays data... -
Drew #2
Re: After submit of a form
Please post your code...
Drew
"green_zipper" <webforumsuser@macromedia.com> wrote in message
news:d3e375$qnd$1@forums.macromedia.com...>I want to allow software to be donwloaded but only after a form is filled
>out ,
> verified and submitted. No matter where I place the code it does not call
> the
> next page that will perfom the donwload. Any help would be great.
>
Drew Guest
-
green_zipper #3
Re: After submit of a form
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<!--#include file="../Connections/Registration.asp" -->
<%
// *** Edit Operations: declare variables
// set the form action variable
var MM_editAction = Request.ServerVariables("SCRIPT_NAME");
if (Request.QueryString) {
MM_editAction += "?" + Server.HTMLEncode(Request.QueryString);
}
// boolean to abort record edit
var MM_abortEdit = false;
// query string to execute
var MM_editQuery = "";
%>
<%
// *** Insert Record: set variables
if (String(Request("MM_insert")) == "form1") {
var MM_editConnection = MM_Registration_STRING;
var MM_editTable = "RegistrationInformation";
var MM_editRedirectUrl = "";
var MM_fieldsStr =
"PASS_Request|value|FirstName|value|LastName|value |CompanyName|value|Title|value
|Phone_Number|value|Alt_Phone_Number|value|Fax_Num ber|value|Address_Line_1|value
|Address_Line_2|value|City|value|State|value|Zipco de|value|Email_Address|value";
var MM_columnsStr =
"PASS_Request|none,1,0|FirstName|',none,''|LastNam e|',none,''|CompanyName|',none
,''|Title|',none,''|Phone_Number|',none,''|Alt_Pho ne_Number|',none,''|Fax_Number
|',none,''|Address_Line_1|',none,''|Address_Line_2 |',none,''|City|',none,''|Stat
e|',none,''|Zipcode|',none,''|Email_Address|',none ,''";
// create the MM_fields and MM_columns arrays
var MM_fields = MM_fieldsStr.split("|");
var MM_columns = MM_columnsStr.split("|");
// set the form values
for (var i=0; i+1 < MM_fields.length; i+=2) {
MM_fields[i+1] = String(Request.Form(MM_fields));
}
// append the query string to the redirect URL
if (MM_editRedirectUrl && Request.QueryString && Request.QueryString.Count >
0) {
MM_editRedirectUrl += ((MM_editRedirectUrl.indexOf('?') == -1)?"?":"&") +
Request.QueryString;
}
}
%>
<%
// *** Insert Record: construct a sql insert statement and execute it
if (String(Request("MM_insert")) != "undefined") {
// create the sql insert statement
var MM_tableValues = "", MM_dbValues = "";
for (var i=0; i+1 < MM_fields.length; i+=2) {
var formVal = MM_fields[i+1];
var MM_typesArray = MM_columns[i+1].split(",");
var delim = (MM_typesArray[0] != "none") ? MM_typesArray[0] : "";
var altVal = (MM_typesArray[1] != "none") ? MM_typesArray[1] : "";
var emptyVal = (MM_typesArray[2] != "none") ? MM_typesArray[2] : "";
if (formVal == "" || formVal == "undefined") {
formVal = emptyVal;
} else {
if (altVal != "") {
formVal = altVal;
} else if (delim == "'") { // escape quotes
formVal = "'" + formVal.replace(/'/g,"''") + "'";
} else {
formVal = delim + formVal + delim;
}
}
MM_tableValues += ((i != 0) ? "," : "") + MM_columns;
MM_dbValues += ((i != 0) ? "," : "") + formVal;
}
MM_editQuery = "insert into " + MM_editTable + " (" + MM_tableValues + ")
values (" + MM_dbValues + ")";
if (!MM_abortEdit) {
// execute the insert
var MM_editCmd = Server.CreateObject('ADODB.Command');
MM_editCmd.ActiveConnection = MM_editConnection;
MM_editCmd.CommandText = MM_editQuery;
MM_editCmd.Execute();
MM_editCmd.ActiveConnection.Close();
if (MM_editRedirectUrl) {
Response.Redirect(MM_editRedirectUrl);
}
}
}
%>
<%
var SoftwareReqestRS = Server.CreateObject("ADODB.Recordset");
SoftwareReqestRS.ActiveConnection = MM_Registration_STRING;
SoftwareReqestRS.Source = "SELECT * FROM RegistrationInformation ORDER BY
TimeStamp";
SoftwareReqestRS.CursorType = 0;
SoftwareReqestRS.CursorLocation = 2;
SoftwareReqestRS.LockType = 1;
SoftwareReqestRS.Open();
var SoftwareReqestRS_numRows = 0;
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Registration Form</title>
<style type="text/css">
<!--
body {
background-color: #66FFFF;
}
.style3 {color: #990000}
.style4 {color: #0000FF}
-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document;
if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++)
x=d.forms[n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++)
x=MM_findObj(n,d.layers.document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_valida teForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail
address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number
between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n';
}
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args+".location='"+args[i+1]+"'");
}
//-->
</script>
</head>
<body>
<div align="left"></div>
<table width="801" height="54" border="1">
<tr>
<td width="801" height="48"><div align="center">
<h1 align="center" class="style3"><span class="style4">FreePASS</span>
Software
Request Form </h1>
</div></td>
</tr>
</table>
<table width="801" border="1" cellspacing="1" cellpadding="1">
<tr>
<td>
<form action="<%=MM_editAction%>" method="POST" name="form1"
onSubmit="MM_validateForm('FirstName','','R','Last Name','','R','Phone_Number',''
,'R','Address_Line_1','','R','City','','R','State' ,'','R','Zipcode','','R','Emai
l_Address','','NisEmail');return document.MM_returnValue">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">Request PASS Software:</td>
<td><input name="PASS_Request" type="checkbox" value=1 checked >
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">First Name:</td>
<td><input type="text" name="FirstName" value="" size="32">
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Last Name:</td>
<td><input type="text" name="LastName" value="" size="32">
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Company Name:</td>
<td><input type="text" name="CompanyName" value="" size="32">
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Title:</td>
<td><input type="text" name="Title" value="" size="32">
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Phone Number:</td>
<td><input type="text" name="Phone_Number" value="" size="32">
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Alternate Phone Number:</td>
<td><input type="text" name="Alt_Phone_Number" value="" size="32">
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Fax Number:</td>
<td><input type="text" name="Fax_Number" value="" size="32">
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Address Line_1:</td>
<td><input type="text" name="Address_Line_1" value="" size="32">
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Address Line_2:</td>
<td><input type="text" name="Address_Line_2" value="" size="32">
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">City:</td>
<td><input type="text" name="City" value="" size="32">
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">State:</td>
<td><input type="text" name="State" value="" size="2">
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Zipcode:</td>
<td><input type="text" name="Zipcode" value="" size="5">
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Email_Address:</td>
<td><input type="text" name="Email_Address" value="" size="32">
</td>
</tr>
<tr valign="baseline">
<td colspan="2" align="right" nowrap><div align="center">
<input name="Submit" type="submit" id="Submit" value="Submit">
<input type="reset" name="Reset" value="Reset">
<input name="Close Window" type=button id="Close Window"
onClick="MM_goToURL('parent','index.htm');return document.MM_returnValue"
value="Home">
</div></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
</form>
<p> </p></td>
</tr>
</table>
<p> </p>
</body>
</html>
<%
SoftwareReqestRS.Close();
%>
I don't have the code for going to my download page but this is where I would
like to go from
green_zipper Guest
-
Drew #4
Re: After submit of a form
Seems that the redirect URL variable is empty. When the form is submitted,
it just reloads the page. You must specify a redirect URL if you want it to
go somewhere after submittion...
Drew> var MM_editRedirectUrl = "";
Drew Guest
-
green_zipper #5
Re: After submit of a form
Drew
Thanks very much. It is so simple when you know the answer. I have spent two days on this and never read about the redirect.
Thanks again
green_zipper Guest
-
Drew #6
Re: After submit of a form
No problem. 5 years ago I couldn't "see" anything... after coming to these
groups and asking a great deal of questions, I can now "see", just not as
well as I'd like...
Drew
"green_zipper" <webforumsuser@macromedia.com> wrote in message
news:d3elo1$rel$1@forums.macromedia.com...> Drew
> Thanks very much. It is so simple when you know the answer. I have spent
> two days on this and never read about the redirect.
> Thanks again
>
Drew Guest



Reply With Quote

