2 Replies Latest reply on Feb 17, 2015 11:09 AM by George_Johnson

    How to multiply input by price

    ColinPritchard Level 1

      Hi,

       

      I'm putting together a order form and would like to have the total filled in for the end-user for each item. There are multiple items, but I', just trying to get Right now, I have an input for Quantity (named AAA-MS) and a read-only input (named AAA-MStotal). When the user puts in the Quantity, I need to multiply that by 200 and then put that value into the read-only input.

       

      I know a bit of Javascript (although I am by no means fluent in it), but I'm unsure how similar this is to a web page.

       

      Right now, I have this script on the read-only input:

      var AAAMS = document.getElementById('AAA-MS').value;

      var AAA-MStotal = document.getElementById('AAA-MStotal');

      AAA-MStotal.value = AAAMS;

       

      I also tried removing the script from AAA-MStotal and adding it to the Quantity input with an onBlur action which triggered this script:

      var AAAMS = document.getElementById('AAA-MS').value;

      document.getElementById('AAA-MStotal').value = AAAMS;

       

      That also did not work.

       

      How can I get this to work? Is my script just wrong? Or do I need to do something different?

       

      Thanks for your help!

      Colin