DB, ASP, Email, Include: Catch-22

  • Thread starter Michael Rothstein
  • Start date
M

Michael Rothstein

I've got a few things I want to do on a form but combing them all seems to
be close to impossible using the default FrontPage 2002 components.

Here are the parameters:

1. I have a form when submitted sends us an email. No database storage is
necessary.

2. I'd like one form field (a drop down) to be populated from a database. I
know how to do this already and understand that the page must then be an ASP
which does not play well with the email submission in the previous parameter

3. If I can't populate the dropdown from a database due to the ASP/Mail
issue, I can create the single field as a separate page and include it on
the 30+ pages that use this dropdown. Although I've been told that I can
not include a form field within a form, manually adding the field name to
the "Saved Fields" will successfully submit the included page along with the
form. The problem is that when changes are saved to the page, the "Saved
Fields" reverts back to the default, which does not include my included form
field and I have to manually add the field again. I'm concerned that I'll
forget to correct the "Saved Fields" and that would cause extra work, not to
mention issues if we receive the emails without the contents of the form
field.

4. We have many forms that submit via email and we have scripts on the
backend that know how to handle the "Formatted Text" that FrontPage forms
generate. I know that there are other mail solutions, but I would rather not
have to deal with rewriting our scripts to handle the format of mail
generated by 3rd party mailers (if in fact they are different).

So basically, I need ASP to read the database, mail to submit or the ability
to turn off the regeneration of "Saved Fields" so I can use the include.
It's really unfortunate that you can't use ASP and mail together on a page.
FrontPage happly lets you do it and it's up to the user to realize that it
doesn't work. Besides all the explanations of ASP and form handlers (which
as an end user I'm not really interested in) is Microsoft going to make this
possible? Can you do it in FrontPage 2003? We're driving a little buggy
around on Mars. I don't think this is a lot to ask, is it?
 
J

Jim Buyens

As you state, FrontPage form handlers and ASP pages are
incompatible, and no, this isn't fixed in FP2003.

The usual approach in cases such as yours is simply to
send the mail using ASP or ASP.NET. Here's a
simple example using ASP:

<body>
<form method="POST">
<input type="text" name="txtBody" size="20"><p>
<input type="submit" value="Submit" name="btnSub"></p>
</form>
<%
Const cdoSchema = _
"http://schemas.microsoft.com/cdo/configuration/"
if request("btnSub") <> "" then
Set objMsg = CreateObject("CDO.Message")
objMsg.Subject = "Test " & now()
objMsg.Sender = "(e-mail address removed)"
objMsg.To = "(e-mail address removed)"
objMsg.TextBody = "The text box said, """ & _
request("txtBody") & """."
objMsg.Configuration.Fields.Item(cdoSchema & _
"sendusing") = 2
objMsg.Configuration.Fields.Item(cdoSchema & _
"smtpserver") = "snmp.crash8.com"
objMsg.Configuration.Fields.Item(cdoSchema & _
"smtpserverport") = 25
objMsg.Configuration.Fields.Update
objMsg.Send
end if
%>
</body>

Alternatively, perhaps you could write some JavaScript
code that would load your values into an empty drop-down
list. That way, the form field could be physically
present in each page, and a .js file could contain a
single copy of the script. For example:

<html>
<head>
<script language="javascript" src="loadtypes.js"></script>
</head>
<body onload="loadTypes();">
<form method="POST">
<p><select size="1" name="ddlType"></select></p>
<p><input type="submit" value="Submit" name="B1"></p>
</form>
</body>
</html>

where loadtypes.js contains:

function loadTypes(){
// Make sure drop-down box is empty.
while (document.forms[0].ddlType.options.length > 1 ){
document.forms[0].ddlType.options[1] = null;
}
// Load drop-down bos items.
document.forms[0].ddlType.options[0] =
new Option ("Animals", "a")
document.forms[0].ddlType.options[1] =
new Option ("Veggies", "v")
document.forms[0].ddlType.options[2] =
new Option ("Minerals", "m")
}

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 
K

Kevin Spencer

You can do anything you want with FrontPage and ASP. What you CAN'T do is do
anything you want with the wizards and other GUI tools that FrontPage
provides. Microsoft has built in a number of components that can do the most
common/typical things that are done with web pages, forms, and databases.
Those most common/typical things comprise about 1% of the possible
combinations of things that one can do with a web application.

You have a couple of choices here. Learn to program ASP and write your own
web application using FrontPage (you can actually write ASP code in Notepad
if you wish - FrontPage just makes it faster, by handling the HTML portion).
You can hire someone who can write ASP code to write your app for you. Or,
you can change your requirements. The only thing you CAN'T do is expect
Microsoft to have a wizard available for every possible functionality you
can imagine.

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

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