Wrox Programmer Forums
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To 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
 
Old June 29th, 2004, 09:13 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 212
Thanks: 0
Thanked 0 Times in 0 Posts
Default Snib, fantastic, but......

Something weird is happening with the variables. I've lined them all up neatly to linefeed into an e-mail. However the code stops at "Home B". Any idea why this is happening. I've included the whole page below:

<html>
<head>
<title>
Parts Request Form
</title>
<H3>Parts Form</H3>
</head>
<body alink ="blue" vlink ="blue">
<table bgcolor ="lightblue" cellpadding ="0" cellspacing ="0" bordercolor ="white"><TR><TD>
<form name ="parts">
Agent<BR>
<input type ="text" size =15 name ="agent"></input><BR>
Delivery Date<BR>
<input type ="text" size =15 name ="deldate"></input><BR>
Delivery Number<BR>
<input type ="text" size =15 name ="delno"></input><BR>
Customer Surname<BR>
<input type ="text" size =15 name ="cust"></input><BR>
Who Complained<BR>
<input type ="text" size =15 name ="who"></input><BR>
Confirm Customer's Telephone Number<BR>
<input type ="text" size =15 name ="conf"></input><BR>Manufacturer (Other)<BR>
<select name ="manu">
<option value ="">--
<option value ="Amana">Amana
<option value ="Ariston">Ariston
<option value ="Asko">Asko
<option value ="Bauknecht">Bauknecht
<option value ="Beko">Beko
<option value ="Bosch">Bosch
<option value ="Candy">Candy
<option value ="Cannon">Cannon
<option value ="Creda">Creda
<option value ="Crusader">Crusader
<option value ="Dyson">Dyson
<option value ="Eng Elec">Eng Elec
<option value ="Hoover">Hoover
<option value ="Hotpoint">Hotpoint
<option value ="Indesit">Indesit
<option value ="Kelvinator">Kelvinator
<option value ="LG">LG
<option value ="Miele">Miele
<option value ="Neff">Neff
<option value ="Servis">Servis
<option value ="Siemens">Siemens
<option value ="Whirlpool">Whirlpool</option>
</select><BR>
Other Manufacturers<BR>
<select name ="comm">
<option value ="">--
<option value ="Admiral">Admiral
<option value ="AEG">AEG
<option value ="Belling">Belling
<option value ="Blomberg">Blomberg
<option value ="Brandt">Brandt
<option value ="Daewoo">Daewoo
<option value ="Delonghi">Delonghi
<option value ="Flavel">Flavel
<option value ="Gorenje">Gorenje
<option value ="Kenwood">Kenwood
<option value ="LEC">LEC
<option value ="Leibherr">Leibherr
<option value ="Leisure">Leisure
<option value ="Moffat">Moffat
<option value ="New World">New World
<option value ="Parkinson Cowan">Parkinson Cowan
<option value ="Proline">Proline
<option value ="Rangemaster">Rangemaster
<option value ="Samsung">Samsung
<option value ="Scandinova">Scandinova
<option value ="Sharp">Sharp
<option value ="Stoves">Stoves
<option value ="Teba">Teba
<option value ="Thomson">Thomson
<option value ="Tricity Bendix">Tricity Bendix
<option value ="Zanussi">Zanussi</option></select><BR>
Serial Number<BR>
<input type ="text" size ="20" name ="serial"><BR>
Notes<BR>
<textarea rows =20 cols = 50 name ="notes"></textarea>
<input type ="button" name ="composer" value = "Compose" onclick ="sendthis()">
<INPUT TYPE="RESET" VALUE="Clear">
</form>
</TR></TD></TABLE>
<script language ="Javascript">
function sendthis(){
var agentvar = document.parts.agent.value
var deldvar = document.parts.deldate.value
var delno1 = document.parts.delno.value
var custsur = document.parts.cust.value
var whocomp = document.parts.who.value
var confcust = document.parts.conf.value
var manuname = document.parts.manu.value
var commanu = document.parts.comm.value
var serial1 = document.parts.serial.value
var notes1 = document.parts.notes.value
location.href="mailto:me@mydomain.com?subject=What ever&body=Agent name: "+ agentvar + "%0D%0A" + "Delivery Date: "

+ deldvar + "%0D%0A" + "Delivery Number: " + delno1 + "%0D%0A" + "Customer Surname: " + custsur + "%0D%0A" + "Who

Complained: " + whocomp + "%0D%0A" + "Customer Tel No: " + confcust + "%0D%0A" + "Manufacturer Name:" + manuname

+ "%0D%0A" + "Home Brand: " + commanu + "%0D%0A" + "Serial Number: " + serial1 + "%0D%0A"+ "Notes: " + notes1;
}
</script>

</body>
</html>

Obviously you'll need to re-wrap the variables above. Its driving me up the wall, because I can't see the problem!!

Thanks in anticipation
interrupt

__________________
\'sync\' &lt;cr&gt;
The name specified is not recognized as an internal or external command, operable program or batch file.
 
Old June 29th, 2004, 10:30 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Ah yes, I've had this problem many times. It is caused by the <select> menu you have inserted. You cannot get the value of the selected option just by using ".value".... no, you have to go to much more trouble :-)

Replace any lines where you are trying to get the value of the selected option with something like this:

//used to be: var commanu = document.parts.comm.value

//now....

var commanu = document.parts.comm.options[document.parts.comm.selectedIndex].value;

HTH,

Snib

<><
 
Old June 29th, 2004, 10:46 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 212
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Snib,

That code works but I still get the same problem. I've done a count of the amount of characters that can be fed from form variable to email body and it seems the maximum is 50? If I shrink the size of one variable, it allows another variable to grow....

Very odd
interrupt

 
Old June 29th, 2004, 10:49 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

What mail client are you using?

http://www.intranetjournal.com/ix/msg/52091.html

Snib

<><
 
Old June 29th, 2004, 10:53 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 212
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Outlook 98






Similar Threads
Thread Thread Starter Forum Replies Last Post
passing javascript to php by Snib ismnanie Pro PHP 5 February 4th, 2005 07:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.