Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 15th, 2010, 01:12 PM
Authorized User
 
Join Date: Sep 2008
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default Classic ASP email not working in Chrome?

Hi

I have programmed many sites in asp using the cdosys and cdo.message for contact forms etc. I am now finding that none of the forms are working in chrome? they have worked fine in IE, Firefox etc but not in chrome. Can anybody help as to why this may be and is there a fix I can do? I have about 15 sites using similar code to the below which works in most browsers. Why would chrome treat this code different?

Many thanks for anyone who can help me solve this problem. The code I know works is:

Dim objMail
Set objMail = Server.CreateObject("CDO.Message")
Set objConfig = Server.CreateObject("CDO.Configuration")

objConfig.Fields(cdoSendUsingMethod) = cdoSendUsingPort
objConfig.Fields(cdoSMTPServer)="auth.smtp.domain. co.uk"
objConfig.Fields(cdoSMTPServerPort)=25
objConfig.Fields(cdoSMTPAuthenticate)=cdoBasic
objConfig.Fields(cdoSendUserName) = "username"
objConfig.Fields(cdoSendPassword) = "password"

'Update configuration
objConfig.Fields.Update
Set objMail.Configuration = objConfig
objMail.From = Request("email")
objMail.To = "somemail@somemail.co.uk"
objMail.Subject = "some subject"
objMail.TextBody = "some text"
objMail.Send
 
Old October 15th, 2010, 01:51 PM
Authorized User
 
Join Date: Jan 2010
Posts: 15
Thanks: 0
Thanked 1 Time in 1 Post
Default

The asp code doesn't run in browser. It merely passes submit request to server where this code runs. You may want to verify if chrome is submitting the request to web server.

Also, what error you are seeing?

Kushal
 
Old October 15th, 2010, 01:57 PM
Authorized User
 
Join Date: Sep 2008
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default Classic ASP email not working in Chrome?

That what is confusing me. I know asp runs serverside so why would Chrome treat it all differently?

I don't get an error message, when I submit, it merely just blanks all input fields and remains on the same page. I have code that simply does a response.redirect to a comfirmation page which is fine in IE and Firefox and has been for years.

I'm confused.
 
Old October 15th, 2010, 02:00 PM
Authorized User
 
Join Date: Sep 2008
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If it is possibly the javascript validation is not working then maybe this is why chrome does not like it. Here is the clientside validation I am using to check user entries prior to submission:

<script type="text/javascript">
function checkForm(theForm) {

if (theForm.elements['firstname'].value == '') {
alert('You must enter your First name.');
theForm.elements['firstname'].focus();
return false;
}
if (theForm.elements['surname'].value == '') {
alert('You must enter your Surname.');
theForm.elements['surname'].focus();
return false;
}
if (theForm.elements['contactnumber'].value == '') {
alert('You must enter your contact phone number.');
theForm.elements['contactnumber'].focus();
return false;
}
if (theForm.elements['email'].value == '') {
alert('You must enter an email address.');
theForm.elements['email'].focus();
return false;
}
if (theForm.elements['enquiry'].value == '') {
alert('You must enter your enquiry details.');
theForm.elements['enquiry'].focus();
return false;
}

document.contactform.submit();
}
</script>
 
Old October 15th, 2010, 02:10 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Where are you calling checkForm( ) from???

If you are calling it from your <form onsubmit="return checkForm(this);"> then you are making a HUGE mistake. You are just lucky the code has worked in other browsers.

If you are doing that, then you *MUST* change your document.contactform.submit() at the end of the function to simply return true;

If that's not what you are doing, show the actual place it is called.
 
Old October 15th, 2010, 02:15 PM
Authorized User
 
Join Date: Sep 2008
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am calling the function from the following:

<form name="contactform" action="contactus.asp" method="post">

Form inputs here then...

<input class="button" type="submit" name="action" value="Submit Enquiry" onClick="javascript:return checkForm(document.contactform);" />
 
Old October 15th, 2010, 02:25 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Same thing, then.

Either change the JS code to just do return true or change the <input> from type="submit" to type="button"

Also, you should never name a form field "submit" or "action" or "method" as those names *HIDE* the properties of the same name in the <form> tag. May not matter in this case, just a bad practice to get into.
 
Old October 15th, 2010, 02:42 PM
Authorized User
 
Join Date: Sep 2008
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Fantastic. Thanks Old Pedant. you nailed it!!!!

It was just a case of adding return true; to the javascript function just before the document.contactform.submit(); in the validation.

Thank you millions!!

Sean.





Similar Threads
Thread Thread Starter Forum Replies Last Post
classic ASP to ASP.NET 2.o XML coding rupen XML 10 May 18th, 2010 03:09 AM
classic ASP to ASP.NET 2.o XML coding rupen ASP.NET 2.0 Basics 0 May 14th, 2010 07:25 AM
ASP.NET Menu & Google Chrome barakros BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 May 13th, 2010 05:45 PM
ASP classic Form to Email problem melkin Classic ASP Basics 0 April 19th, 2007 10:28 AM
send email automatically with classic asp crmpicco Classic ASP Professional 6 July 4th, 2006 09:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.