[thelist] Form & Grand Total
Mona_Nisoff at bd.com
Mona_Nisoff at bd.com
Fri Oct 20 13:38:37 CDT 2000
I initially thought Jay's example would work work in this situation. However...
One person in my company has a form that asks users to enter expenses incurred
by
our company and expenses incurred by a third party. So, I actually have two
sets of 12
values each that need to be added. Here's the code from our FrontPage form. I
thought
about renaming my <input name="">, but this form also sends results to the
administrator
of this form and requires more descriptive input names than Value1, Value2...
<form method="POST" name="FrontPage_Form2"
onsubmit="return FrontPage_Form2_Validator(this)" action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" startspan
U-File="../_private/form_results.txt" S-Format="TEXT/CSV"
S-Label-Fields="TRUE" B-Reverse-Chronology="FALSE"
U-File="Product_Recall_log.htm" S-Format="HTML/BR" S-Label-Fields="TRUE"
B-Reverse-Chronology="TRUE" S-Email-Format="TEXT/PRE"
S-Email-Address="CorporateRisk at bd.com" B-Email-Label-Fields="TRUE"
B-Email-Subject-From-Field="FALSE" S-Email-Subject="Product Recall Form"
S-Date-Format="%B %d, %Y" S-Time-Format="%I:%M %p"
S-Builtin-Fields="REMOTE_NAME REMOTE_USER HTTP_USER_AGENT Date Time"
U-Confirmation-Url="Product_Recall_confirmation.htm" --><input TYPE=
"hidden" NAME="VTI-GROUP" VALUE="0"><!--webbot
bot="SaveResults" endspan --><table
border="0" cellspacing="0" width="100%" bgcolor="#FFCC33" cellpadding="2">
<tr>
<td width="40%" valign="bottom" height="34"><b>CATEGORY</b></td>
<td width="30%" valign="top" align="center" height="34"><b>Cost to
Company<br>
(000's)</b></td>
<td width="30%" valign="top" align="center" height="34"><b>Cost to 3rd
Party<br>
(000's)</b></td>
</tr>
<tr>
<td width="40%" height="50"><b>Advertising / Notificaton</b> </td>
<td width="30%" valign="top" align="center" height="50"><input type=
"text"
name="BdCostAdvertising" size="10" tabindex="10"></td>
<td width="30%" valign="top" align="center" height="50"><b><input
type="text"
name="PartyCostAdvertising" size="10" tabindex="11"></b></td>
</tr>
<tr>
<td width="40%" height="34"><b>Labor (incl. overtime, temps) </b></td>
<td width="30%" valign="top" align="center" height="34"><input type=
"text"
name="BdCostLabor" size="10" tabindex="12"></td>
<td width="30%" valign="top" align="center" height="34"><input type=
"text"
name="PartyCostLabor" size="10" tabindex="13"></td>
</tr>
<tr>
<td width="40%" height="25"><b>Travel Expenses </b></td>
<td width="30%" valign="top" align="center" height="25"><input type=
"text"
name="BdCostTravel" size="10" tabindex="14"></td>
<td width="30%" valign="top" align="center" height="25"><input type=
"text"
name="PartyCostTravel" size="10" tabindex="15"></td>
</tr>
<tr>
<td width="40%" height="34"><strong>Product Disposal</strong></td>
<td width="30%" valign="top" align="center" height="34"><input type=
"text"
name="BdCostWarehouse" size="10" tabindex="16"></td>
<td width="30%" valign="top" align="center" height="34"><input type=
"text"
name="ThirdCostWarehouse" size="10" tabindex="17"></td>
</tr>
<tr>
<td width="40%" height="34"><b>Temporary Warehouse Rental</b> </td>
<td width="30%" valign="top" align="center" height="34"><input type=
"text"
name="BdCostWarehouse" size="10" tabindex="18"></td>
<td width="30%" valign="top" align="center" height="34"><input type=
"text"
name="ThirdCostWarehouse" size="10" tabindex="19"></td>
</tr>
<tr>
<td width="40%" height="50"><b>Freight (both to recover product and
redistribute
replacement)</b> </td>
<td width="30%" valign="top" align="center" height="50"><input type=
"text"
name="BdCostFreight" size="10" tabindex="20"></td>
<td width="30%" valign="top" align="center" height="50"><input type=
"text"
name="ThirdCostFreight" size="10" tabindex="21"></td>
</tr>
<tr>
<td width="40%" height="25"><b>Repackaging</b> </td>
<td width="30%" valign="top" align="center" height="25"><input type=
"text"
name="BdCostRepackaging" size="10" tabindex="22"></td>
<td width="30%" valign="top" align="center" height="25"><input type=
"text"
name="PartyCostRepackaging" size="10" tabindex="23"></td>
</tr>
<tr>
<td width="40%" height="25"><b>Postage</b> </td>
<td width="30%" valign="top" align="center" height="25"><input type=
"text"
name="BdCostPostage" size="10" tabindex="24"></td>
<td width="30%" valign="top" align="center" height="25"><input type=
"text"
name="PartyCostPostage" size="10" tabindex="25"></td>
</tr>
<tr>
<td width="40%" height="25"><b>Printed Material</b> </td>
<td width="30%" valign="top" align="center" height="25"><input type=
"text"
name="BdCostPrintedMaterial" size="10" tabindex="26"></td>
<td width="30%" valign="top" align="center" height="25"><input type=
"text"
name="PartyCostPrintedMaterial" size="10" tabindex="27"></td>
</tr>
<tr>
<td width="40%" height="34"><b>Cost product </b></td>
<td width="30%" valign="top" align="center" height="34"><input type=
"text"
name="BdCostLostDueToRecall" size="10" tabindex="28"></td>
<td width="30%" valign="top" align="center" height="34"><input type=
"text"
name="ThirdCostLostDueToRecall" size="10" tabindex="29"></td>
</tr>
<tr>
<td width="40%" height="25"><b>Lost Profits</b> </td>
<td width="30%" valign="top" align="center" height="25"><input type=
"text"
name="BdCostBusInterruption" size="10" tabindex="30"></td>
<td width="30%" valign="top" align="center" height="25"><input type=
"text"
name="ThirdCostBusinessInterruption" size="10" tabindex="31"></td>
</tr>
<tr>
<td width="40%" height="25"><b>Lost Sales</b> </td>
<td width="30%" valign="top" align="center" height="25"><input type=
"text"
name="BdCostBusInterruption" size="10" tabindex="32"></td>
<td width="30%" valign="top" align="center" height="25"><input type=
"text"
name="ThirdCostBusinessInterruption" size="10" tabindex="33"></td>
</tr>
<tr>
<td width="34%" height="36"><b>GRAND TOTAL</b></td>
<td width="33%" height="36" valign="top" align="center"><b></b><input
type="text"
name="BdCostTotal" size="10" tabindex="34"></td>
<td width="33%" height="36" valign="top" align="center"><b></b><input
type="text"
name="ThirdCostTotal" size="10" tabindex="35"></td>
</tr>
</table>
<div align="center"><center><p><input type="submit" value="Submit" name=
"Submit"
tabindex="37"> <input type="reset" value="Reset" name="B2"></p>
</center></div>
</form>
Thank you,
Mona
"Jay Turley" <jay at weberrific.org> on 10/20/2000 01:16:29 PM
Please respond to thelist at lists.evolt.org
To: thelist at lists.evolt.org
cc: (bcc: Mona Nisoff/RTP/BDX)
Subject: RE: [thelist] Form & Grand Total
> -----Original Message-----
> From: Mona_Nisoff at bd.com [mailto:Mona_Nisoff at bd.com]
>
> Does anyone have or know where I can l get a javascript that
> will add the values
> a user enters into 12 separate input fields to ultimately
> come up with the grand
> total
> of those values?
Here ya go:
<html>
<head>
<title>Untitled</title>
<script language="javascript" type="text/javascript">
<!--
function addVals() {
form = document.myForm;
var total = 0;
for (i=1; i<=12; i++) {
var inputVal = eval("form.value"+i+".value");
total += parseInt(inputVal);
}
form.grandTotal.value = total;
}
// -->
</script>
</head>
<body>
<form name="myForm">
<input name="value1" type="text" value="0"><br>
<input name="value2" type="text" value="0"><br>
<input name="value3" type="text" value="0"><br>
<input name="value4" type="text" value="0"><br>
<input name="value5" type="text" value="0"><br>
<input name="value6" type="text" value="0"><br>
<input name="value7" type="text" value="0"><br>
<input name="value8" type="text" value="0"><br>
<input name="value9" type="text" value="0"><br>
<input name="value10" type="text" value="0"><br>
<input name="value11" type="text" value="0"><br>
<input name="value12" type="text" value="0"><br>
<input type="button" value="click to add values" onClick="addVals()"><br>
<input name="grandTotal" type="text" value="">
</form>
</body>
</html>
- Jay Turley ---------------------------------------------------------
http://www.weberrific.org
"Any sufficiently advanced magic is indistinguishable from technology"
---------------------------------------
For unsubscribe and other options, including
the Tip Harvester and archive of TheList go to:
http://lists.evolt.org Workers of the Web, evolt !
More information about the thelist
mailing list