Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 15th, 2010, 01:12 PM
Authorized User
 
Join Date: Sep 2008
Location: , , .
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
Reply With Quote
  #2 (permalink)  
Old October 15th, 2010, 01:51 PM
Authorized User
Points: 57, Level: 1
Points: 57, Level: 1 Points: 57, Level: 1 Points: 57, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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
Reply With Quote
  #3 (permalink)  
Old October 15th, 2010, 01:57 PM
Authorized User
 
Join Date: Sep 2008
Location: , , .
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.
Reply With Quote
  #4 (permalink)  
Old October 15th, 2010, 02:00 PM
Authorized User
 
Join Date: Sep 2008
Location: , , .
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>
Reply With Quote
  #5 (permalink)  
Old October 15th, 2010, 02:10 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
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.
Reply With Quote
  #6 (permalink)  
Old October 15th, 2010, 02:15 PM
Authorized User
 
Join Date: Sep 2008
Location: , , .
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);" />
Reply With Quote
  #7 (permalink)  
Old October 15th, 2010, 02:25 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
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.
Reply With Quote
  #8 (permalink)  
Old October 15th, 2010, 02:42 PM
Authorized User
 
Join Date: Sep 2008
Location: , , .
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.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 02:23 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.