0

i have a form field named ABC and i want to calculate its value and get the result at XYZ hidden field. I use rsform.

the calculation:

XYZ = ABC / 105 * 12

I don't have code knowledge please help in detail. Thank you!

  • 1
    Displaying the relevant source code would be a good start. What do you have so far and what attempts have you made? – NewToJS Mar 13 '15 at 23:32
  • i have tried to write some code, which i googled, in javascript area but couldn't make it work. So i need to place this code at javascript area. The calculation it is simple as that i posted – Valantis Mar 13 '15 at 23:40
  • If you display the source you have so far we have something to work we, we debug **your** source code and explain the reason(s) for it not functioning as intended and offer any solution(s) if we have them. – NewToJS Mar 13 '15 at 23:43

1 Answers1

1

The easiest way is to add an id attribute to the form and hidden fields (the id attribute is added the same way as you assigned the name attribute) and:

document.getElementById('XYZ').value = document.getElementById('ABC').value / 105 * 12;

Update

A simple example:

<!DOCTYPE html>
<html>
<body>
    <input type="text" id="ABC" value="10" />
    <input type="text" id="XYZ" value="" />
</body>
<script>
     document.getElementById('XYZ').value = document.getElementById('ABC').value / 105 * 12;  
</script>
</html>
E_d
  • 132
  • 2
  • 9