I know that all of you Super GURU's are looking for something simple to do.
I have a dynamically created form that I have working with the following
code.
My problem is, that I am telling it how many items to update.
I need my update that is below to be more dynamic and I am going nuts with
it.
Any help on how to make this more dynamic would be greatly appreciated.
if(CalElmNo==1){
this.OrderForm.Itm1Bal.value =
cent(callingElement.value *
<cfoutput>#PartsArray[1][4]#</cfoutput>);
}
else if(CalElmNo==2){
this.OrderForm.Itm2Bal.value =
cent(callingElement.value *
<cfoutput>#PartsArray[2][4]#</cfoutput>);
}
else if(CalElmNo==3){
this.OrderForm.Itm3Bal.value =
cent(callingElement.value *
<cfoutput>#PartsArray[3][4]#</cfoutput>);
}
else if(CalElmNo==4){
this.OrderForm.Itm4Bal.value =
cent(callingElement.value *
<cfoutput>#PartsArray[4][4]#</cfoutput>);
}
else if(CalElmNo==5){
this.OrderForm.Itm5Bal.value =
cent(callingElement.value *
<cfoutput>#PartsArray[5][4]#</cfoutput>);
}
else if(CalElmNo != 'e'){
this.OrderForm.Itm1Bal.value = cent(1 *
<cfoutput>#PartsArray[1][4]#</cfoutput>);
this.OrderForm.Itm2Bal.value = cent(1 *
<cfoutput>#PartsArray[2][4]#</cfoutput>);
this.OrderForm.Itm3Bal.value = cent(1 *
<cfoutput>#PartsArray[3][4]#</cfoutput>);
this.OrderForm.Itm4Bal.value = cent(1 *
<cfoutput>#PartsArray[4][4]#</cfoutput>);
this.OrderForm.Itm5Bal.value = cent(1 *
<cfoutput>#PartsArray[5][4]#</cfoutput>);
}
var SubTot =
(this.OrderForm.Itm1Bal.value-0)+(this.OrderForm.Itm2Bal.value-0)+(this.Orde
rForm.Itm3Bal.value-0)+(this.OrderForm.Itm4Bal.value-0)+(this.OrderForm.Itm5
Bal.value-0);
this.OrderForm.Sub_Total.value = cent(SubTot);
if(this.OrderForm.State.value=="IA"){
var OrdTax =
((this.OrderForm.Itm1Bal.value-0)+(this.OrderForm.Itm2Bal.value-0)+(this.Ord
erForm.Itm3Bal.value-0)+(this.OrderForm.Itm4Bal.value-0)+(this.OrderForm.Itm
5Bal.value-0))* .06;
this.OrderForm.Tax.value = cent(OrdTax);
}else{
this.OrderForm.Tax.value = cent(0);
}
if(this.OrderForm.Sub_Total.value > 100){
OrdShip =
Math.floor(this.OrderForm.Sub_Total.value / 100) * 10;
this.OrderForm.Shipping.value = cent(OrdShip);
}else{
OrdShip = 10.00;
this.OrderForm.Shipping.value = cent(OrdShip);
}
if(this.OrderForm.State.value=="IA"){
var OrdTot = (SubTot-0) + (OrdTax-0);
this.OrderForm.Order_Total.value =
cent((OrdTot-0) + (OrdShip-0));
}else{
this.OrderForm.Order_Total.value =
cent((SubTot-0) + (OrdShip-0));
}
}
Larry Juncker
Senior Cold Fusion Developer
Heartland Communications Group, Inc.
[EMAIL PROTECTED]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists