I'll take a look, but I see right away that the function cover_price has
no opening bracket.
-David

On Sat, 25 Mar 2000 20:49:32 -0600 "Chris Montgomery" <[EMAIL PROTECTED]>
writes:
> Howdy folks,
> 
> If any Javascript wizards have a few moments and can help, I would
> certainly appreciate it.
> 
> Below is some code for a page that contains a form that uses 
> Javascript
> to update calculated values.  The second form SELECT is not updating 
> the
> total_price form field.  The team I'm working with needs to resolve 
> this
> problem with Javascript not working in the form by Monday morning, 
> so
> timeliness is of the essence.
> 
> Can anyone see the problem?
> 
> Code follows:
> =========================
> <!--- Sets the Product Code, Cover Desc., Cover Cost, and shipping.
> Input is coming from Cover.cfm   --->
> <CFIF #IsDefined("FORM.COVER_QUANTITY")#>
>    <CFSET SESSION.DFLT_MAL_CLS_CD = "#FORM.COVER_MAL_CLS_CD#">
>    <CFSET SESSION.COVER_PRODUCT_CODE= "#Form.Cover_Product_Code#">
>    <CFSET SESSION.COVER_DESCRIPTION= "#Form.Cover_Description#">
>    <CFSET SESSION.COVER_COST= "#Form.Cover_Cost#">
>    <CFSET SESSION.COVER_COST_ADD = "#FORM.COVER_COST_ADD#">
>    <CFSET SESSION.COVER_IMAGE="#FORM.COVER_IMAGE#">
>    <CFSET SESSION.Cover_Quantity = "#FORM.Cover_Quantity#">
>    <CFSET SESSION.COVER_SHIPPING_DESC = "Bulk Mail">
>    <CFSET SESSION.COVER_SHIPPING_METHOD = "B">
>    <CFSET SESSION.COVER_COST_ADD2 = #SESSION.COVER_COST_ADD#>
> </CFIF>
> 
> <CFQUERY name="COVER_SHIP_COST" datasource="#DATASOURCE1#">
> SELECT MAL_CLS_CD, MAL_CLS_DESC, MAL_CLS_CST, PLT_PRD.BND_TYP
> FROM MAL_CLS_TIER, PLT_PRD
> WHERE MAL_CLS_TIER_CD = '#SESSION.MAL_CLS_TIER_CD#'
> AND   MAL_CLS_TIER.PRD_TYP_CD = '02'
> AND PLT_PRD.ORD_ENT_PRD_CD = '#SESSION.COVER_PRODUCT_CODE#'
> AND MAL_CLS_TIER.BND_TYP = '#SESSION.BINDING#'
> ORDER BY MAL_CLS_CST
> </CFQUERY>
> 
> <CFSET mail_class_cost = #cover_ship_cost.mal_cls_cst#>
> 
> <!DOCTYPE html public "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML>
> <HEAD>
> <TITLE>Cover Quantity</TITLE>
> <META http-equiv="Pragma" content="no_cache">
> <META http-equiv="EXPIRES" content="Wednesday, 25-Dec-95 01:01:01 
> GMT">
> <META http-equiv="REFRESH">
> 
> <SCRIPT LANGUAGE="Javascript">//function to change the cover price 
> as
> multiple quantities are chosen
>       function cover_price(form)
> 
> 
>       // if only one cover is chosen, the standard cover price is 
> given
>       if (form.Cover_QUANTITY.selectedIndex == 0)
>       {
>       form.cover_price2.value =  
> <cfoutput>#session.cover_cost#</cfoutput>;
>       }
>       else
>       {
>       form.cover_price2.value = (form.Cover_QUANTITY.selectedIndex 
> *
> <cfoutput>#session.cover_cost_add2#</cfoutput>) +
> <cfoutput>#session.cover_cost#</cfoutput>;
>       }
> 
>       result = calc_precision(form.cover_price2.value);
> 
>       return(result);
>       }
> 
>       function calc_precision(in_value)
>       {
>       alert("in calc_precision");
>       precision = 2;   // Set the precision to 2 places past the 
> decimal
> point
> 
>       var whole = "" + Math.round(in_value * Math.pow(10, 
> precision));
> 
>       var decPoint = whole.length - precision;
> 
>       if(decPoint != 0)
>       {
>       result = whole.substring(0, decPoint);
>       result += ".";
>       result += whole.substring(decPoint, whole.length);
>       }
>       else
>       {
>       result = whole;
>       }
>       alert("calc_precision returning "+result);
>       return(result)
>       }
> 
>               function calc_Total()
>               {
>       alert("in calc_total");
>       total_result = 
> parseFloat(document.Cover_qty.cover_price2.value) +
> <cfoutput>#COVER_SHIP_COST.mal_cls_cst#</cfoutput>;
>       alert("calc_total total_result is "+total_result);
>       result = calc_precision(total_result);
>       alert("calc_total returning "+result);
>       return(result);
>       }
> </SCRIPT>
> 
> </HEAD>
> 
> <BODY bgcolor="White"
> onLoad="document.Cover_qty.total_price.value=calc_Total()">
> <CENTER><BR><B><FONT face="Arial" size="2" color="Black">Standard
> Delivery for Covers is Bulk Mail.<BR>You may upgrade delivery
> below.</FONT></B>
> 
> <CFFORM name="Cover_qty" action="COVER_ORDER_OUT.cfm" method="POST"
> target="_top">
> <TABLE width="475" cellspacing="0" cellpadding="2" align="CENTER"
> valign="TOP" border="1">
>    <TR>
>       <TD><B><FONT face="Arial" size="2" color="Black">
>               <DIV align="right">Your Cover Selection:</FONT>
>               </DIV></B>
>       </TD>
>       <TD align="middle"><CFOUTPUT><IMG
> src="../covers/#SESSION.COVER_IMAGE#"></CFOUTPUT>
>       </TD>
>    </TR>
>    <TR>
>       <TD>&nbsp;
>       </TD>
>       <TD align="middle"><CFOUTPUT>#SESSION.COVER_DESCRIPTION# 
> Leather
> Cover</CFOUTPUT>
>       </TD>
>    </TR>
>    <TR>
>       <TD><B><FONT face="Arial" size="2" color="Black">
>               <DIV align="right">Select Cover Quantity:
>               </DIV>
>       </TD>
>       <TD><FONT face="ms sans serif, geneva" size="2">
>          <SELECT name="Cover_QUANTITY"
>
onChange="document.Cover_qty.cover_price2.value=cover_price(this.form);d
> ocument.Cover_qty.total_price.value=calc_Total()">
>             <OPTION value="1"<cfif #session.cover_quantity# is
> 1>selected</CFIF>>1 Cover
>             <OPTION value="2"<cfif #session.cover_quantity# is
> 2>selected</CFIF>>2 Covers
>             <OPTION value="3"<cfif #session.cover_quantity# is
> 3>selected</CFIF>>3 Covers
>             <OPTION value="4"<cfif #session.cover_quantity# is
> 4>selected</CFIF>>4 Covers
>             <OPTION value="5"<cfif #session.cover_quantity# is
> 5>selected</CFIF>>5 Covers
>          </SELECT>&nbsp; &nbsp;Price:&nbsp; $<CFOUTPUT>
>          <INPUT type="text" name="cover_price2"
> value="#DecimalFormat(Evaluate(SESSION.COVER_COST +
> (SESSION.COVER_COST_ADD * (SESSION.COVER_QUANTITY - 1))))#" size="5"
> maxlength="5"
>
onChange="this.value=cover_price(this.form);document.Cover_qty.total_pri
> ce.value=calc_Total()"></CFOUTPUT></FONT>
>       </TD>
>    </TR>
>    <TR>
>       <TD valign="TOP" align="RIGHT"><B><FONT face="ms sans serif,
> geneva" size="2">
>               <DIV align="right">Shipping Method:</DIV></FONT></B>
>       </TD>
>       <TD><!--- If Form data comes from cover_indiv.cfm, then set
> shipping cost, otherwise don't --->
> <CFIF #IsDefined("FORM.COVER")#>
>    <CFSET SESSION.COVER_SHIPPING_CST2 = COVER_SHIP_COST.MAL_CLS_CST>
> </CFIF><FONT face="ms sans serif, geneva" size="2">
> 
> ****************************************************
> The onChange in the SELECT statement below is where the code
> appears to be broken.
> ****************************************************
> 
>          <SELECT name="Cover_SHIPPING_METHOD"
> onChange="document.Cover_qty.total_price.value=calc_Total()">
> <CFOUTPUT query="COVER_SHIP_COST">
>             <OPTION value="#MAL_CLS_CD#"< cfif
> session.cover_shipping_method is #mal_cls_cd#>selected
> </CFIF>>#Trim(MAL_CLS_DESC)#: $#Trim(MAL_CLS_CST)#</CFOUTPUT>
>          </SELECT></FONT>
> 
>       </TD>
>    </TR>
>    <TR>
>       <TD valign="BOTTOM"><B><FONT face="ms sans serif, geneva"
> size="2">
>               <DIV align="right">Total:
>               </DIV></FONT></B>
>       </TD>
> 
> *****************************************
> This is where choosing one of the affected Select options
> above should update the total price, but it isn't working.
> *****************************************
> 
>       <TD valign="BOTTOM"><FONT face="ms sans serif, geneva" 
> size="2">$
>          <INPUT type="text" name="total_price" size="5" 
> maxlength="5"
> onChange="this.value=calc_Total()"></FONT>
>       </TD>
>    </TR>
>    <TR>
>       <TD colspan="3" align="left" valign="left"><FONT
> size="-1"><I>&nbsp;
> <P>WARNING: UPS does NOT deliver to P.O. Box Addresses.  When 
> selecting
> Ground, 2nd Day, or Overnight Delivery, please make sure past order 
> was
> delivered to a physical address.  If not, please exit 
> order!</I></FONT>
>       </TD>
>    </TR>
>    <TR>
>       <TD colspan="3" align="center"><BR>&nbsp;<BR>
>          <INPUT type="Image" name="Click here to submit data"
> src="../../reorder/submit.gif" border="0">&nbsp;&nbsp;&nbsp;&nbsp;<A
> href="http://companynamechangedtoprotecttheinnocent.com/www"
> target="_top"><IMG src="../../reorder/exit.gif" border="0"></A>
>       </TD>
>    </TR>
> </CFFORM>
> </TABLE>
> </CENTER>
> </BODY>
> </HTML>
> =========================
> End code
> 
> Thanks a bunch!!
> 
> Chris Montgomery
> =========================================================
> astutia.com -> http://www.astutia.com  [EMAIL PROTECTED]
>   Astute e-business applications & web site development
>       210-490-3249/888-745-7603   Fax 210-490-4692
> Allaire Consulting Partner/Authorized NetObjects Reseller
>   Find a Job in San Antonio ->  http://www.sajobnet.com
> =========================================================
> 
>
-------------------------------------------------------------------------
-----
> Archives: http://www.eGroups.com/list/cf-talk
> To Unsubscribe visit 
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk

> or send a message to [EMAIL PROTECTED] with 
> 'unsubscribe' in the body.

________________________________________________________________
YOU'RE PAYING TOO MUCH FOR THE INTERNET!
Juno now offers FREE Internet Access!
Try it today - there's no risk!  For your FREE software, visit:
http://dl.www.juno.com/get/tagj.
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to