Avatar of elieazzi
Flag for United States of America asked on

Addition fields in JavaScript. Quantity * total = total then total 1+total2 = Final total.

Hello Expert,

I have this file is working: http://www.caf-fca.org/english/test/  The forms is working ALL.

As JavaScript i want you to help me or write me the script to

In the Quantity
If the user put Quantity = 1 , the total will be $ 3.00 then if he put 2, the total will be $6.00 right
Samething for the french one.
And the total field will be the addition of the English total and the French total.

Thank you for your time.

Avatar of undefined
Last Comment

8/22/2022 - Mon

I'm sorry, this is the source code for  http://www.caf-fca.org/english/test/index.asp


<form name="YourFormName" method="Post" action="confirmation.asp">
<tr><td width="109">Company Name: </td>
<td width="383"><input type="text" name="txtCompanyName" size="50"></td></tr>
<tr><td>Address: </td>
<td><input type="text" name="txtAddress" size="50"></td></tr>
<tr><td>City: </td>
<td><input type="text" name="txtCity" size="50"></td></tr>
<tr><td>Postal Code: </td>
<td><input type="text" name="txtPostalCode1" value="" size="3"> - <input type="text" name="txtPostalCode2" value="" size="3"></td></tr>
<tr><td>Email: </td>
<td><input type="text" name="txtEmail" size="50"></td></tr>
<tr><td>Comments: </td>
<td><textarea name="Comments"></textarea></td></tr>
         <td colspan="2"><div align="right">
             <table width="100%" border="0" cellspacing="3" cellpadding="3">
               <tr bgcolor="#FFFFCC" class="byline">
                  <td width="14%" class="byline"><strong>Quantity</strong></td>
                  <td width="54%" class="byline"><strong>Description</strong></td>
                  <td width="16%" class="byline"><strong>Price</strong></td>
                  <td width="16%" class="byline"><div align="center"><strong>TOTAL</strong></div></td>
                <tr bgcolor="#FFFFCC" class="byline">
                   <td><div align="center"><input name="QuantityEnglish" type="text" id="QuantityEnglish" size="3"></div></td>
                   <td class="byline">Making  it Work! (English)</td>
                   <td><div align="center"><p class="byline">$3.00</p></div></td>
                   <td><div align="center"><p class="byline">$  <input name="TotalEnglish" type="text" id="TotalEnglish" size="5"></p></div></td>
                <tr bgcolor="#FFFFCC" class="byline">
                   <td><div align="center"><input name="QuantityFrench" type="text" id="QuantityFrench" size="3"></div></td>
                   <td class="byline">Pour arriver &agrave; des r&eacute;sultats! (French)</td>
                   <td><div align="center"><p class="byline">$3.00</p></div></td>
                   <td><div align="center"><p class="byline">$ <input name="TotalFrench" type="text" id="TotalFrench" size="5"></p></div></td>
                <tr bgcolor="#FFFFCC" class="byline">
                   <td class="byline"><div align="center">TOTAL</div></td>
                           <td><div align="center"><p class="byline">$ <input name="TOTAL" type="text" id="TOTAL" size="5"></p></div></td>
   <input type="submit" name="Submit" value="Submit Form">

And this is source code for the confirmation.asp

DIM strEmail, strName, strComments, objMail
strName = request.form("Name")
strComments = request.form("Comments")

Set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.From = "info@caf-fca.org"
objMail.Subject = "Thank you Elie"
objMail.To = "elie_azzi@caf-fca.org"
objMail.Body = "Email: " & strEmail & vbCrLf & _
"Name: " & strFirstName & vbCrLf & _
"Comments: " & vbCrLf & strComments
objMail.Importance = 2

objMail.body="<html>" & VBCrLF & "<Title></Title>" & VBCrLf & "<Head></Head>" & VBCrLf & "<Body>" & vbCrLf & _
"<h3><center><font color=red>Making it work! - Online Order</font></center></h3>" & VBCrLf & _
"<h3><font color=Blue>Making it work!</font></h3>" & VBCrLf & _
"<p><strong>Date Submitted:</strong> " & Now() & VBCrLf & VBCrLf & _
"<h3><font color=Blue>Making it work!</font></h3>" & VBCrLf & _
"<p><strong>Company Name:</strong> " & Request.Form("txtCompanyName") & VBCrLf & VBCrLf & _
"<p><strong>Address:</strong> " & Request.Form("txtAddress") & VBCrLf & VBCrLf & _
"<p><strong>City:</strong> " & Request.Form("txtCity") & VBCrLf & VBCrLf & _
"<p><strong>Postal Code:</strong> " & Request.Form("txtPostalCode") & VBCrLf & VBCrLf & _
"<p><strong>Your Email:</strong> " & Request.Form("txtEmail") & VBCrLf & VBCrLf & _
"<p><strong>Your English Quantity : </strong> " & Request.Form("QuantityEnglish") & VBCrLf & VBCrLf & _
"<p><strong>Your English Quantity Total : $</strong> " & Request.Form("TotalEnglish") & VBCrLf & VBCrLf & _
"<p><strong>Your French Quantity :</strong> " & Request.Form("QuantityFrench") & VBCrLf & VBCrLf & _
"<p><strong>Your French Quantity Total: $</strong> " & Request.Form("TotalFrench") & VBCrLf & VBCrLf & _
"<p><strong>The Final Total is : $ </strong> " & Request.Form("Total") & VBCrLf & VBCrLf & _
"</body>" & VBCrLf & "</html>"
Set objMail = nothing

strName = request.form("Name")
Response.Write strName

<P>Thank you for emailing me.</P>


Thank you for your time!!!


Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

You're the BEST !!!  I'll add another question in JavaScript to make 2 fields mandatory fields right now...
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck