181 lines
7.5 KiB
HTML
181 lines
7.5 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252">
|
|
<TITLE>ProcessForm</TITLE>
|
|
<SCRIPT LANGUAGE="JavaScript">
|
|
<!--
|
|
TempString = navigator.appVersion
|
|
if (navigator.appName == "Microsoft Internet Explorer"){
|
|
// Check to see if browser is Microsoft
|
|
if (TempString.indexOf ("4.") >= 0){
|
|
// Check to see if it is IE 4
|
|
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
|
|
}
|
|
else {
|
|
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
|
|
}
|
|
}
|
|
else if (navigator.appName == "Netscape") {
|
|
// Check to see if browser is Netscape
|
|
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
|
|
}
|
|
else
|
|
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
|
|
//-->
|
|
</script>
|
|
<SCRIPT LANGUAGE="VBScript">
|
|
<!--
|
|
Sub Window_OnLoad()
|
|
Dim frmContents
|
|
On Error Resume Next
|
|
If Not Parent Is Nothing Then
|
|
Set frmContents = Parent.Contents
|
|
If Not frmContents Is Nothing Then
|
|
frmContents.Window.TOCSynch_Click
|
|
End If
|
|
End If
|
|
End Sub
|
|
//--></SCRIPT><META NAME="DESCRIPTION" CONTENT="Internet Information Services reference information">
|
|
<META HTTP-EQUIV="PICS-Label" CONTENT='(PICS-1.1 "<http://www.rsac.org/ratingsv01.html>" l comment "RSACi North America Server" by "inet@microsoft.com <mailto:inet@microsoft.com>" r (n 0 s 0 v 0 l 0))'>
|
|
<META NAME="MS.LOCALE" CONTENT="EN-US">
|
|
<META NAME="MS-IT-LOC" Content="Internet Information Services">
|
|
</HEAD>
|
|
|
|
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
|
|
|
|
<H2><A NAME="_processform"></A><SUP></SUP>ProcessForm</H2>
|
|
|
|
<P>The <B>ProcessForm </B>method merges data from a template file with form data submitted by a user, and creates a new file. The data submitted by the user can be manipulated by script in the template file.</P>
|
|
|
|
<H6>Syntax</H6>
|
|
|
|
<P><I>oTools</I><B>.ProcessForm(</B><I>OutputFileURL</I>, <I>TemplateURL</I>, [<I>InsertionPoint</I>]<B>)</B></P>
|
|
|
|
<P> </P>
|
|
|
|
<H6>Parameters</H6>
|
|
|
|
<DL>
|
|
<DT><I>OutputFileURL</I></DT>
|
|
|
|
<DD>A string containing the relative URL of the file to which the merged data is written. <BR>
|
|
</DD>
|
|
|
|
<DT><I>TemplateURL </I></DT>
|
|
|
|
<DD>A string containing the relative URL of the template file. <BR>
|
|
</DD>
|
|
|
|
<DT><I>InsertionPoint </I></DT>
|
|
|
|
<DD>An optional parameter indicating where in the template file to start inserting the process data. This parameter has not been implemented. If you include a value for this parameter it will be ignored.<BR>
|
|
</DD>
|
|
|
|
<DT></DT>
|
|
</DL>
|
|
|
|
<P><span class=le><B>Note</B></span></P>
|
|
|
|
<P>The template file can contain ASP scripts. </P>
|
|
|
|
<P>A script between <% and %> delimiters is treated just like other text in the template and copied into the output file. If the output file is an ASP document, the script will run when the output file is executed.</P>
|
|
|
|
<P>If you want script in the template to be executed during the call to ProcessForm, place your code between special <%% and %%> delimiters. Since these scripts are executed before the template data is saved in the output file, the results get saved in the output file, usually as standard text. </P>
|
|
|
|
<P>If the specified output file exists, the server will overwrite it.</P>
|
|
|
|
<P>If the <I>InsertionPoint</I> parameter does not exist, Tools.ProcessForm replaces the entire output file. If the <I>InsertionPoint</I> parameter exists, and does not begin with an asterisk (*), Tools.ProcessForm finds the <I>InsertionPoint</I> string in the output file and inserts the data immediately after it. If the <I>InsertionPoint</I> string begins with an asterisk (*), Tools.ProcessForm finds the <I>InsertionPoint</I> string in the output file and inserts the data immediately before it. If the <I>InsertionPoint</I> string exists, but is not found in the output file, the data is appended to the end of the file.</P>
|
|
|
|
<H6>Example</H6>
|
|
|
|
<P>The following example uses two files. Tools_Template.asp is a template file for a personal Web page. Tools_ProcessForm.asp takes some input from a user, and calls <B>ProcessForm</B> to copy the template data to a new file with the updates given by the user. Run the example by browsing to Tools_ProcessForm.asp.</P>
|
|
|
|
<P>--- Tools_Template.asp ---</P>
|
|
|
|
<PRE><CODE><HTML>
|
|
<HEAD>
|
|
<TITLE><%% =Request.Form("company") %%></TITLE>
|
|
</HEAD>
|
|
|
|
<BODY bgcolor="<%% =Request.Form("bgcolor") %%>">
|
|
<FONT face="<%% =Request.Form("fface") %%>" size=<%% =Request.Form("fsize") %%>>
|
|
|
|
<H5 align=center>This file was created on <%% =Date %%> at <%% =Time %%></H5>
|
|
|
|
<%
|
|
Response.Write "<H3 align=center>Welcome to the home page for:</H3>"
|
|
Response.Write "<H1 align=center><%% =Request.Form("company") %%></H1>"
|
|
Set MyPageCounter = Server.CreateObject("MSWC.PageCounter")
|
|
MyPageCounter.PageHit
|
|
Response.Write "<P align=center>This page has been hit " & MyPageCounter.Hits & " times."
|
|
%>
|
|
|
|
<P><B>About my Company:</B>
|
|
<P><%% =Request.Form("about") %%>
|
|
|
|
</FONT>
|
|
</BODY>
|
|
|
|
</HTML></CODE></PRE>
|
|
|
|
<P>--- Tools_ProcessForm.asp ---</P>
|
|
|
|
<PRE><CODE><HTML>
|
|
<HEAD><TITLE></TITLE></HEAD>
|
|
<BODY>
|
|
|
|
<%
|
|
OutputURL = Request.Form("outputurl")
|
|
BGColor = Request.Form("bgcolor")
|
|
FFace = Request.Form("fface")
|
|
FSize = Request.Form("fsize")
|
|
Company = Request.Form("company")
|
|
About = Request.Form("about")
|
|
|
|
Process = True
|
|
If "" = OutputURL Then Process = False
|
|
If "" = BGColor Then Process = False
|
|
If "" = FFace Then Process = False
|
|
If "" = FSize Then Process = False
|
|
If "" = Company Then Process = False
|
|
If "" = About Then Process = False
|
|
%>
|
|
|
|
<H3>Create a Default Company Page Using the Tools_Template.asp Template</H3>
|
|
|
|
Please fill out the form. All fields are required.
|
|
<FORM NAME="GetTemplateStuff" METHOD="POST" ACTION="Tools_ProcessForm.asp">
|
|
<input type="TEXT" NAME="outputurl" size=70 value="<%=OutputURL%>"> Relative Output URL<BR>
|
|
<input type="TEXT" NAME="bgcolor" size=70 value="<%=BGColor%>"> Background Color<BR>
|
|
<input type="TEXT" NAME="fface" size=70 value="<%=FFace%>"> Font Face<BR>
|
|
<input type="TEXT" NAME="fsize" size=70 value="<%=FSize%>"> Font Size<BR><BR>
|
|
<input type="TEXT" NAME="company" size=70 value="<%=Company%>"> Company Name<BR>
|
|
<input type="TEXT" NAME="about" size=70 value="<%=About%>"> About Your Company<BR><BR>
|
|
<INPUT type="SUBMIT" VALUE="Create File">
|
|
</FORM>
|
|
|
|
<%
|
|
If Process Then
|
|
Set oTools = Server.CreateObject("MSWC.Tools")
|
|
oTools.ProcessForm OutputURL,"Tools_Template.asp","<HTML*>"
|
|
%>
|
|
<P><A href="<%=OutputURL%>"><%=OutputURL%></A> was created.
|
|
<%
|
|
Else
|
|
Response.Write "No file was created because of missing inputs."
|
|
End If
|
|
%>
|
|
|
|
</BODY>
|
|
</HTML>
|
|
</CODE></PRE>
|
|
|
|
<H6>See Also</H6>
|
|
|
|
<P><A HREF="/iishelp/iis/htm/asp/comp1d9v.htm"><B>FileExists</B></A>, <A HREF="/iishelp/iis/htm/asp/comp8kdp.htm"><B>Random</B></A> </P>
|
|
<hr class="iis" size="1">
|
|
<p align="center"><em><a href="../../../common/colegal.htm">© 1997-2001 Microsoft Corporation. All rights reserved.</a></em></p>
|
|
</BODY>
|
|
</HTML>
|