PDA

View Full Version : desperately need help with code



studionews
01-05-2004, 03:14 PM
Hello,
Can someone help me with the code for my form? I'm trying to create a feedback form that my visitors would complete as they exit my site. I would like the form data to be sent to me via email. For some reason the email is not functioning properly. I'm not sure what I'm missing or doing wrong. Thanks in advance!
Here's the code I have set up so far...

<form name="feedback" method="post" action="mailto:customerservice@thestudionextdoor.com" onSubmit="this.mail; ReadForm (this);">
<p class="style3"><span class="style6">Did you find our website to be easy to navigate through?</span>
<select name="select" size="1">
<option value="Definately Easy" selected>Definately Easy</option>
<option value="Somewhat Easy">Somewhat Easy</option>
<option value="Not Easy at all">Not Easy at all</option>
</select>
</p>
<p class="style3">Did you find our selection of photography and prices to be competitive with other online galleries?
<select name="select2" size="1">
<option value="Great selection, great prices" selected>Great selection, great prices</option>
<option value="Competitive selection, competitive prices">Competitive selection, competitive prices</option>
<option value="Not enough selection, prices too high">Not enough selection, prices too high</option>
</select>
</p>
<p class="style3"> <span class="style6">Please list the reasons you didn't purchase from our website today?</span>
<textarea name="textarea2" cols="25" rows="1">Please be specific...</textarea>
</p>
<p class="style3"> What would you like to see or what suggestions do you have about the website?
<textarea name="textarea" cols="50" rows="2">Please list your suggestions here...</textarea>
</p>
<p align="center"><span class="style3">Thank you for your suggestions! Please click the SUBMIT button below and your suggestions will be evaluated by our team as they are received. If you have further questions or concerns please contact us by phone at 404.664.3227 or via email customerservice@thestudionextdoor.com.</span></p>
<p align="center">
<input type="submit" name="Submit" value="Submit">
</p>
</form>

Corey Bryant
01-05-2004, 03:27 PM
What is

onSubmit="this.mail; ReadForm (this);"
doing? If I take that out - it seems to work. Of course, the user will require an e-mai client installed on the computer.

studionews
01-05-2004, 03:33 PM
Thanks. I took the code: onSubmit="this.mail; ReadForm (this);" out of the form but I still cannot get the data to send via email when I test. Do you have any other suggestions to make this work?

paulhiles
01-05-2004, 03:35 PM
What is

onSubmit="this.mail; ReadForm (this);"
doing? If I take that out - it seems to work. Of course, the user will require an e-mai client installed on the computer.
I was thinking along the same lines Corey... also.. I was looking for some clarification from studionews... do you want the form to appear as a popup page as the visitor leaves the site? OR is it simply part of a Contact area on the site?

Paul

studionews
01-05-2004, 03:41 PM
Do I need to take the onSubmit command out all together?

Yes this feedback form is set to popup as the visitor leaves the site and I would like the data the visitor selects from this form to be sent to me via an email to customerservice@thestudionextdoor.com when they hit the submit button.

paulhiles
01-05-2004, 04:21 PM
Okay then, as I understand it, you're using a JavaScript function to call your feedback form. This script is currently referenced in your homepage but nowhere else. If you want the feature to be sitewide, you'll need to reference that script from each of your main pages.
You use the unload command in the page's body tag to prompt the script into action (see below)

<body onUnload="PopWindow420424()">
as with the script, you'll need to modify that line in each of your pages (apart from the feedback form itself obviously!).

Try that out, and let me know how you get on.

Paul

studionews
01-05-2004, 04:28 PM
the popup is working fine. What I need to do now is get the data from the popup fields (http://www.thestudionextdoor.com/feedback.htm) the user will enter to be sent to me via email when they hit the submit button. Is this possible? I think I'm lacking JS to make this work right...not quite sure how to get that.

paulhiles
01-05-2004, 04:33 PM
I accessed the feedback form and sent the following mail (via Mozilla Firebird/Outlook) about 20 minutes ago.. did you not receive that email?


select=Definately+Easy&select2=Great+selection%2C+great+prices
&textarea2=Please+be+specific...
&textarea=Please+list+your+suggestions+here...
&Submit=Submit
I've also sent one via Internet Explorer, and that simply attaches the form information in a file called postdata.att (you can open this in Notepad).

To get reliable, formatted emails you really need to use server side scripting CGI, ASP or PHP. These technologies all have the ability to validate and process the form fields and format them to your requirements. Does your hosting allow for server side script to run?

Paul

redcircle
01-05-2004, 05:35 PM
I need to see the code this came from in the form tag

onSubmit="this.mail; ReadForm (this);"

I don't know what ReadForm does.

Also you are trying to use mailto: this will only work if the user has configured an email client on the computer. Which means if someone is at the library or some other sort of public location this form will not work.

My suggestion is to use formmail or some other cgi script.

paulhiles
01-05-2004, 06:44 PM
You're spot on redcircle, (as usual!) the member is currently using the mailto command.

NB: This post was also submitted to the Site Design forum, and the two posts have now been merged.

studionews
01-05-2004, 10:16 PM
cool! You guys are awesome. You're hilarious Paul - got your email :). You guys are right the mailto causes problems and the emails I'm getting are very difficult to decifer. I will try your suggestions...if I can figure it out. ;-)If you haven't already noticed, I'm a little blonde at this stuff.

studionews
01-06-2004, 12:44 PM
Hi guys! Thanks for all your help yesterday! I was wondering if you could help me with another question. :) I have updated the script for formmail but I'm not sure I have it right. I took a web tutorial with Univ of Vermont online.
<form action="http://scripts.thestudionextdoor.com/cgi-bin/FormMail.pl" method="post" name="feedback">
<input type="hidden" name="recipient" value="customerservice@thestudionextdoor.com">
When I test the submit button I get a "Cannot find server -The page cannot be displayed" error and no email. Can you tell me what I'm missing? Thanks a bunch!

paulhiles
01-06-2004, 12:56 PM
Hi there Heidi,

Could you tell us exactly where the FormMail.pl script is to be found? I'm hoping it's stored in your cgi-bin folder as indicated... it may be that the script isn't configured correctly.

Often it can be simply traced back to the initial 'shebang' line in the script.. this contains the location of the Perl interpreter on your server, which then enables the script to be executed. Typically you would have a line like the following: #!/usr/local/bin/perl

Hope that helps,

Paul

PS. I was also a bit confused as to why you've added the 'scripts' subdomain to the URL (is this just for your own testing?)

studionews
01-06-2004, 01:17 PM
What you're saying makes complete sense. I haven't put the script into my cgi-bin...the tutorial didn't tell me I had to do that. :0 Obviously, I'm really green at web programming so I'm not thinking like one. If I'm not told to do something it doesn't get done. Should I change the path or could you point me in the direction to develop the script for the cgi-bin?

PS. I was also a bit confused as to why you've added the 'scripts' subdomain to the URL (is this just for your own testing?) I followed the same format as used in the tutorial. I can remove this if it's not needed.

paulhiles
01-06-2004, 01:26 PM
Should I change the path or could you point me in the direction to develop the script for the cgi-bin?The script should be stored in your cgi-bin.. if you'd like to send me a copy of the script by PM or email.. I don't mind looking it over.


I followed the same format as used in the tutorial. I can remove this if it's not needed.I would just use your standard URL i.e. http://thestudionextdoor.com/cgi-bin/FormMail.pl
Let me know when you've done that! :o)

Paul