 |
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
|
|
|

October 15th, 2010, 01:12 PM
|
Authorized User
|
|
Join Date: Sep 2008
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|

October 15th, 2010, 01:51 PM
|
Authorized User
|
|
Join Date: Jan 2010
Posts: 15
Thanks: 0
Thanked 1 Time in 1 Post
|
|
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
|

October 15th, 2010, 01:57 PM
|
Authorized User
|
|
Join Date: Sep 2008
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|

October 15th, 2010, 02:00 PM
|
Authorized User
|
|
Join Date: Sep 2008
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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>
|

October 15th, 2010, 02:10 PM
|
Friend of Wrox
|
|
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
|
|
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.
|

October 15th, 2010, 02:15 PM
|
Authorized User
|
|
Join Date: Sep 2008
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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);" />
|

October 15th, 2010, 02:25 PM
|
Friend of Wrox
|
|
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
|
|
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.
|

October 15th, 2010, 02:42 PM
|
Authorized User
|
|
Join Date: Sep 2008
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
|
 |