Click to See Complete Forum and Search --> : Another send form question


borzoid
09-13-2003, 02:51 PM
Greetings,

I am trying to develop a form to email to customers asking for details for the work they want done which they could then send back to me. I do understand some of the basics of javascript and have used codes from off of the internet but this is beyond me. I have tried the "mailto" instructions given in other posts here and only get a blank email without any data at all.


I did find a nice simple script that does the trick but it defines the content in one field (body) and I have several fields. I would like the reply to include any fields that have been selected (checkboxes) or have had data entered but for the sake of simplicity do not care if blank fields are included as it is a small form. I know that this would have something to do with defining the variables in the script but there my knowledge ends. Here is the script. I greatly appreciate any help given.

Connie

<head>
<script>
function doIt()
{
var S=document.exf2.subject.value;
var B=document.exf2.body.value;
self.location="mailto:someone@somewhere.com?subject="+S+"&body="+B;
}
</script>
</head>


<body>
<form name=exf2>
<input type=hidden name=subject value="Subject"><BR>
<input type=text name=body value="Body"><BR>

<input type=button value="SUBMIT" onclick="doIt()">
</form>
</body>

Jona
09-13-2003, 05:53 PM
<head>
<script type="text/javascript"><!--
function doIt()
{
var S=document.exf2.subject.value;
var B=document.exf2.body.value+document.exf2.body2.value;
self.location="mailto:someone@somewhere.com?subject="+S+"&body="+B;
}
//--></script>
</head>
<body>
<form name="exf2"><div>
<input type="hidden" name="subject" value="Subject"><BR>
<input type="text" name="body" value="Body"><BR>
<input type="text name="body2" value="Second field"><br>
<input type="button" value="SUBMIT" onclick="doIt()">
</div></form>
</body>


[J]ona

borzoid
09-13-2003, 08:48 PM
Thank you Jona

The script you wrote does work. However I will need to revise my form as it does not seem to recogize input from checkboxes or radio buttons, only text.

I can work around that easily enough but would like to know if carriage returns can be added to the result.

Thanks again,

Connie

Jona
09-13-2003, 08:50 PM
Yes, turn your INPUTs into TEXTAREAs instead, and keep the name attribute the same.

[J]ona

borzoid
09-14-2003, 08:28 AM
Well I tried it with textarea but the script still reads the fields as undefined. Thanks for your efforts anyway. I have learned bunches about forms through this process.

I'll use a service to gather the data and send the form. Maybe when I can find time to have someone to hold my hand through cgi I will try again. :rolleyes:


Connie

pyro
09-14-2003, 08:49 AM
If your server supports PHP, just use http://www.webdevfaqs.com/php.php#mailer

borzoid
09-14-2003, 10:20 AM
Thanks Pyro,

HMMM...That looks like an option. I'll see how it works.

I was under the gun to get this out this weekend and I had already written the form so I threw it up on bravenet this morning as another site I'm working with needed it right away.

I have all of a sudden found myself very busy working on site changes for the early holiday shopping season so may not get to playing with the php stuff right away.

Thanks again

Connie

pyro
09-14-2003, 12:48 PM
No problem... :)