Skip to main content
Dave_Hollings
Inspiring
December 22, 2007
Answered

Problem with my email form

  • December 22, 2007
  • 10 replies
  • 1014 views
Hi all,

I have run into a small issue and cannot see what is causing my email form not to work. I have done this a few times now and have copied the actionscript I have working currently however the it still does not work. The form can be view live here and the flash file can be downloaded from here.

I have attached the code for my flash form below and if anyone requires the code for my email.cfm page (this is the page that processes and sends the emails) then please let me know. I would appreciate any help I can get with this and I have been working on this for a couple of days now and have re-written the code about 6 times - it's starting to do my head in.

Thank you in advance.

This topic has been closed for replies.
Correct answer Greg Dove
FYI:
the difference between
var _loc3 = new LoadVars();

and
var _loc3:LoadVars = new LoadVars();

is nothing in terms of the generated bytecode.

But it is a best practice. It enables code hinting and type checking etc.

10 replies

Inspiring
December 23, 2007
I'm pretty sure there are a number of php examples in the forum here. It seems to be a frequent question, although one I don't think I have answered personally.
I'm guessing it probably wouldn't be too difficult to find a php example here or elsewhere online, but yes you would need to get familiar with the other scripting language enough to be able to port your cfm script.
Inspiring
December 22, 2007
I've always sent back the LoadVars response as urlencoded name/value pairs same as how its sent to the server... I don't think it would make sense to do intentionally otherwise. Perhaps flash filters out the other stuff in your case if its working...seems unusual though. If you're happy that its working then that's fine...I guess.
Dave_Hollings
Inspiring
December 23, 2007
I'm back with one more question (sorry) - After getting this to work using cfm email processing a thought crossed my mind about other server side scripts. I have asked my client if they wish me to host their new site however I have not heard anything. I can host ColdFusion, php and a multitude of other scripts however their current hosting package I am unaware of. So I was wondering if you might know how I could change my email.cfm page into another scripting language providing similar results for example a email to both my clients and their customers formatted in html? I have no knowledge whatsoever outside of CF.

Thanks and look forward to your comments / suggestions.
Inspiring
December 22, 2007
And thanks for the nice comments BTW. Happy to help.
Inspiring
December 22, 2007
no it wasn't the email I was referring to.. its the response to the sendAndLoad in flash
Inspiring
December 22, 2007
But your script response is still not well formed from the server.

It should be straight text like:

&result=true;

(which is what you're aiming to do)

But instead its prefixing some css info and wrapping in a body tag
Inspiring
December 22, 2007
Your server response looks like the following instead of just

&result=true
Inspiring
December 22, 2007
Hmmm I got this in my email:

This is an automated email response from Whole New World.
Many thanks for your interest in Whole New World and our products, we hope you managed to find the information you were looking for. You are receiving this email as confimation of an enquiry we have just received. Our dedicated staff will be in touch within 36 hours of receiving your enquiry and hope to speak to you soon.

And I got a confirmation message
Dave_Hollings
Inspiring
December 22, 2007
That email you got is part of the email coding it's just confirmation that your enquiry has been sent.
Greg DoveCorrect answer
Inspiring
December 22, 2007
FYI:
the difference between
var _loc3 = new LoadVars();

and
var _loc3:LoadVars = new LoadVars();

is nothing in terms of the generated bytecode.

But it is a best practice. It enables code hinting and type checking etc.
Dave_Hollings
Inspiring
December 22, 2007
Well not sure what I have done but I tested the new code and it still did not work, however waited for about 10 minutes and got an email from yourself so I tested from here and it's all working fine very thing is working as it should.

Can't thank you enough it has been a pleasure talking to you and thanks, you are a real asset to this forum and people like myself.

Kind regards - David
Inspiring
December 22, 2007
At the moment your script is returning an error message complaining that CONTACTNUM is undefined . Perhaps you have named it telehphone in flash and its CONTACTNUM in your CFM script


comments=Testing%20from%20adobe%20forum&subject=Web%20Site%20Comments&telephone=&email=spamfree%2Edove%40gmail%2Ecom&fullname=GWD
Dave_Hollings
Inspiring
December 22, 2007
Not sure how you managed to find that but many thanks - as soon as I looked at the email.cfm code again (line 46) as you mentioned I realised contactnum is not a variable 'telephone' is. The same is true for line (59) for Form.enquiry should be 'comments'. Both of these are repeated further down on lines 105 and 114 respectively.

Just corrected the code but still no luck!
Inspiring
December 22, 2007
FYI your cfm script seems to throw an error on line 46 if the phone number is not submitted.
Inspiring
December 22, 2007
At the moment your send button is not triggering the event based code to perform the sendAndLoad.

It appears as if you are using a component button
So you need to change the event handling code to be more like the combo box code.

So not this:
send_btn.onRelease = function

but more like:

clickListener = new Object();
clickListener.click= function() { //same as the old onRelease handler

//and further down...
send_btn.addEventListener("click", clickListener);
Dave_Hollings
Inspiring
December 22, 2007
Thanks for your input and I see what you are saying, however after changing the code as suggested the button still does not action the code. The weird thing is as far as I am concerned if it executing the code to a certian point but no further. I'll try and explain:

Within the button function (clickListener) there is are some if and else if statements checking to ensure the user has populated the required form fields, when the user clicks the send button and flash detects that a certain required field is undefined or blank then an alert box is shown with a relating message e.g. user clicks send without populating the comments field the app will display an alert box with 'Please provide details of your enquiry' message.

This is working correctly however when all fields are completed as required and the user clicks the send button nothing happens. The app should display another alert box either stating that the enquiry has been sent and a copy has been sent to the email address provided, or an error in sending the email was detected.

This comes from the email.cfm page. The code within the cfm page is basically a cfmail tag with a if / else statement which should send back to flash a true or false message. Flash then should determine that true equals success and false equals unsucessful and run the relative action as describe above.

Any other suggestions? Does the code I posted look correct? I have provided the code once again with the amendments that you suggested - and thank you I appreciate the help.


Inspiring
December 22, 2007
Sorry I'm just dealing with things as I see them rather than going through all of your code. That's got something working now... It's actually sending the data. And seemed to be working correctly when I just tested it.