I have the following code which I'm using to calculate the price of a custom order item. The math is working fine.. the problem is simply that I cant get the script to take the form values and apply them to the item_description field. I have another form with fewer fields that is working fine.. I keep going over it and cant figure out why it doesn't work. I am somewhat new to Javascript so am still making stupid mistakes I dont have the experience to troubleshoot at times. Any help is appreciated.
Code:<script> function calcField_form1(){ CalcField.addEquation('form1', 'finishdepth=depth+1.25'); CalcField.addEquation('form1', 'finishheight=height+1'); CalcField.addEquation('form1', 'price=(length/12)*(finish+style+12)'); CalcField.addEquation('form1', 'shipping=(pickup*price*.30)*(1+(zip/60000))'); } calcField_form1(); </script>Code:<script src="/accounting.js"></script> <script type="text/javascript"> function money () { var price = document.getElementById('price').value; var pricea = accounting.formatMoney(price); document.getElementById('item_price').value = pricea; var shipping = document.getElementById('shipping').value; var shipa = accounting.formatMoney(shipping); document.getElementById('item_ship_price').value = shipa; var length = document.getElementById('length').value; var height = document.getElementById('height').value; var depth = document.getElementById('depth').value; var left = document.getElementById('left').value; var right = document.getElementById('right').value; var baseheightleft = document.getElementById('baseheightleft').value; var basedepthleft = document.getElementById('basedepthleft').value; var baseheightright = document.getElementById('baseheightright').value; var basedepthright = document.getElementById('basedepthright').value; var finishing = document.getElementById('finishing').value; var style = document.getElementById('style').value; var bracket = document.getElementById('bracket').value; var finishheight = document.getElementById('finishheight').value; var finishdepth = document.getElementById('finishdepth').value; var notes = document.getElementById('notes').value; var pickup = document.getElementById('pickup').value; //------------This is where I'm having the problem with the script document.getElementById('item_description').value = "Custom Baseboard Cover to fit heater " + length + " inches wide, " + height + " inches high and " + depth + " inches deep. Overall dimensions of cover will be " + finishheight + " inches high, " + finishdepth + " inches deep. Cover will have a baseboard cutout " + baseheightleft + " inches high by " + basedepthleft + " inches deep on the left and " + baseheightright + " inches high by " + basedepthright + " inches deep on the right. On the left side " + left + ". On the right side " + right + ". Cover will be sent " + finishing + ". Cover will have " + style + ". Cover will: " + bracket + " Your cover " + pickup + ". Additional notes you provided: " + notes; } </script>
<input type="submit" value="Add To Cart" name="B1" onclick="return money();"/></p>
</form>[/HTML]


Reply With Quote

Bookmarks