473,811 Members | 3,627 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with JavaScript CDONTS code

I have the following code in an ASP webpage where a member has logged
in and wants to change his company information. This page lists the
fields and records currently in our database (Access) and he is able to
make changes and submit it. My code updates the database fine and
redirects them to another page fine.

Now I want that information emailed to me as well. I have found code
and spent hours tweeking it to work and I finally get NO errors. The
only problem is that when I receive the e-mail, all of the fields say
undefined instead of the actual record. For instance:

THIS IS THE EMAIL:

Company: undefined
Division: undefined
Mailing Address: undefined

THIS IS THE CODE:

<%

var objCDO = Server.CreateOb ject("CDONTS.Ne wMail");
objCDO.From = "webmaster@...o rg"
objCDO.To = "me@...org"
objCDO.Subject = "Member Company Updated!"
objCDO.Body = "The following member company information has been
updated." + "\n\n"
+ "Company: " + Request.Form("M brCompany") + "\n"
+ "Division: " + Request.Form("e mail") + "\n"
+ "Mailing Address: " + Request.Form("M brMailingAddres s") + "\n"
+ "Mailing City, State, Zip: " + Request.Form("M brMailingCity") + " "
+ Request.Form("M brMailingState" ) + " " + Request.Form("M brMailingZip")
+ "\n\n"
+ "Shipping Address: " + Request.Form("M brShippingAddre ss") + "\n"
+ "Shipping City, State, Zip: " + Request.Form("M brShippingCity" ) + "
" + Request.Form("M brShippingState ") + " " +
Request.Form("M brShippingZip") + "\n\n"
+ "Phone: " + Request.Form("M brMainPhone") + "\n"
+ "Alt Phone: " + Request.Form("M brAltPhone") + "\n"
+ "Fax: " + Request.Form("M brMbrFax") + "\n"
+ "Intl Phone: " + Request.Form("M brPhoneIntl") + "\n"
+ "Intl Fax: " + Request.Form("M brFaxIntl") + "\n"
+ "Email: " + Request.Form("M brEmail") + "\n"
+ "Website: " + Request.Form("M brWebsite") + "\n\n"
+ "Please file this in the member's folder."
objCDO.BodyForm at = 1
objCDO.MailForm at = 1
objCDO.Send()
objCDO = null

%>

Any help????

Jul 23 '05 #1
4 2715


cm*******@nfda-fastener.org wrote:
I have the following code in an ASP webpage where a member has logged
in and wants to change his company information. This page lists the
fields and records currently in our database (Access) and he is able to
make changes and submit it. My code updates the database fine and
redirects them to another page fine.

Now I want that information emailed to me as well. I have found code
and spent hours tweeking it to work and I finally get NO errors. The
only problem is that when I receive the e-mail, all of the fields say
undefined instead of the actual record. For instance:

THIS IS THE EMAIL:

Company: undefined objCDO.Body = "The following member company information has been
updated." + "\n\n"
+ "Company: " + Request.Form("M brCompany") + "\n"


Well if it says undefined then in the ASP page with that code
Request.Form("M brCompany") yields undefined. As you say that you
redirect then the problem is probably simply that HTTP POST information
is not transferred when redirecting thus any attempt in ASP to read
Request.Form("a rgname") will give you undefined.
Or that ASP page receives the data in the query string part of the URL
and then
Request.QuerySt ring("MbrCompan y")
is the proper way to extract the data.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2
Thanks for the response Martin. I tried replacing the Request.Form with
Request.QuerySt ring, but it still gives me undefined values in the
email. Any other suggestions?

Jul 23 '05 #3


ConnieM wrote:
I tried replacing the Request.Form with
Request.QuerySt ring, but it still gives me undefined values in the
email. Any other suggestions?


For a start don't bother with emailing stuff but find out first how data
is passed to the page, if no data is passed to the page in the query
string then Request.QuerySt ring can't give you any data in the ASP page.
All you are doing is building a string e.g.

"The following member company information has been
updated." + "\n\n"
+ "Company: " + Request.Form("M brCompany") + "\n"
+ "Division: " + Request.Form("e mail") + "\n"

or now

"The following member company information has been
updated." + "\n\n"
+ "Company: " + Request.QuerySt ring("MbrCompan y") + "\n"
+ "Division: " + Request.QuerySt ring("email") + "\n"

obviously in ASP those Request properties do only reflect what is passed
to the page thus if you get undefined then nothing has been passed to
the page.

So you need to look at how data is passed to the page, to have data in
the query string you for instance would need a link alike
<a href="http://example.com/mail.asp?MbrCom pany=company&em ail=whoever">
the ASP will have values for
Request.QuerySt ring("MbrCompan y")
and
Request.QuerySt ring("email")

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #4
"ConnieM" <cm*******@nf da-fastener.org> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
Thanks for the response Martin. I tried replacing the Request.Form
with
Request.QuerySt ring, but it still gives me undefined values in the
email. Any other suggestions?


As Martin has already suggested, you mention that you "redirect to
another page" after processing the form. This will result in "throwing
away" all the values of the Request.QuerySt ring() and Request.Form()
collections.

A redirect simply tells the browser to do a GET on the new URL, anything
in the POST buffer (or originally passed to <FORM
ACTION="yourFor mHandler.asp?So mething=Whateve r">) is lost when the
browser requests the new page.

If you actually want to pass data from the page that handles <FORM
ACTION="..."> to a new page, you have two options:

1) store the values of the form in the Session object and retrieve them
on the new page (I don't recommend this)
2) take the values obtained from Request.Form(), write script to build a
query string containing the information you want and pass it to the
redirect page as part of the redirect.

So, on the page that handles <FORM ACTION="...">

<%
var CompanyNameVar = Request.Form('C ompanyName');
var BlahBlahVar = Request.Form('B lahBlah');
var SomethingElseVa r = Request.Form('S omethingElse');

// update the database and do whatever

Response.Redire ct(
"SendEmail.asp? " +
"CompanyNam e=" +
Server.URLencod e(CompanyNameVa r) +
"&BlahBlah= " +
Server.URLencod e(BlahBlahVar)) ;
%>

NOW the values of CompanyName, BlahBlah (but NOT SomethingElse) will be
accessible to SendEmail.asp using Request.QuerySt ring(). If you want
SomethingElse too, _you_ have to include it on the query string passed
to SendEmail.asp.

Of course, if you try to pass large (> 512 bytes) of information this
way, you run the risk that the browser won't pass the entire query
string correctly, resulting in lost data.

--
Grant Wagner <gw*****@agrico reunited.com>
comp.lang.javas cript FAQ - http://jibbering.com/faq
Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4707
by: | last post by:
Hi Guys CDONTS works with all sites hosted on my test server bar one (which surely rules out a miscomputation of the Default SMTP server in IIS). I have tried uploading the file with make up the site in which CDONTS to one of the IIS "sites" which is known to work with CDONTS, and still, no email received. The bad mail dir gets three files each time, the error is:
29
3549
by: | last post by:
I did a working code with CDONTS on NT4 Now I am testing is on w2k and it looks like objCDONTS.Send is completely ignored. I think is it ignored because it throws no errors, neither does the rest of the code setting objCDONTS=Server.CreateObject("CDONTS.NewMail") and then manipulating its properties. Do I need to somehow set IIS5 to make objCDONTS.Send work?
44
3266
by: Mike | last post by:
I'm used to unix/cgi scripts so im slightly out of my depth here. Ive got an asp script for a website form which works fine. What i want to do is also get the form to include the ip address of the perosn sending the form ie <input type=hidden name=env_report value=REMOTE_ADDR> Anyone know how to apply this to this asp script below?: <%
2
1222
by: Savas Ates | last post by:
im sending email with cdonts.. my mail format is html format.. and also in my mail code there are html and javascript codes. i open my mail with outlook it works.. but im sending it to hotmail or yahoo emails the browser doesnt interpret it writes javascript codes like a text on screen. how can i solve it?
16
3175
by: tshad | last post by:
I have both cdosys.dll and cdonts.dll on my W2K3 server. We have been told by our web authors that their asp code won't work on our machine and that we don't have CDONTS installed on our machine. They're getting an error from: Set objCDOMail = Server.CreateObject("CDONTS.NewMail") I know that the new format is:
9
6276
by: scott | last post by:
I have my win 2003 server setup correct with SMTP. I know because I've tested it ok. However, when I issue CODE 1 below, I get ERROR 1 below. I thought having SMTP installed correctly allowed ASP to use CDONTS as a mail generator. Is there more to it? CODE 1: Set objMail = Server.CreateObject("CDONTS.NewMail")
2
1460
by: Joey | last post by:
I am currently developing a C# asp.net application where users are required to register. The application then generates a simple, plain text email and sends it to the new user. I have been trying to use the MailMessage and SmtpMail classes from the System.Web.Mail namespace (built in to .net) to do this. It is my understanding that these classes use CDONTS (cdosys.dll) and the SMTP mail service on the server to send the messages....
14
2195
by: tbird2340 | last post by:
I want to write an if / then statement and have tried using this: var MyVarMailto; if (Request.Form("LoanRequest") == "Under $250,000") { if (Request.Form("Organization") == "1") { MyVarMailto = "emailA@address.com"; } } else if (Request.Form("LoanRequest") == "Over $250,000") { if (Request.Form("Organization") == "1") {
7
2892
by: Paul | last post by:
I have just started work on a system using CDONTS to mail out. Whilst this is fine on the server, my local development machine is using XP Pro with IIS5.1 installed. Is there a way I can get the functionality of cdonts so that I can test/develop on my local machine, preferably without actually sending any mail to the persons involved.
0
10651
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10403
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10136
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9208
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7671
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6893
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5555
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4341
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3868
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.