Link to home
Start Free TrialLog in
Avatar of elieazzi
elieazziFlag 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 elieazzi
elieazzi
Flag of United States of America image

ASKER

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

-------------------------------
<html>
<body>

<form name="YourFormName" method="Post" action="confirmation.asp">
<table>
<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>
<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>
                <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>
                <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>
                <tr bgcolor="#FFFFCC" class="byline">
                   <td>&nbsp;</td>
                   <td>&nbsp;</td>
                   <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>
                        </tr>
             </table>
      </tr>
   </table>
</td>
</tr>
</table>
   <input type="submit" name="Submit" value="Submit Form">
   </form>
</body>
</html>
------------------------------------

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.BodyFormat=0  
objMail.MailFormat=0
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>"
objMail.Send
Set objMail = nothing
%>

<P>
<%
strName = request.form("Name")
Response.Write strName
%>,</P>

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

=========================

Thank you for your time!!!

Ely.
ASKER CERTIFIED SOLUTION
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You're the BEST !!!  I'll add another question in JavaScript to make 2 fields mandatory fields right now...