Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 173
  • Last Modified:

Getting data to fill a form

Ive got a page with 3 forms.

Basically form 1 you enter in a number and form 2 you enter in a number and Ive got a calculation plugged in and Im trying to get the results of form 1 x form 2 to display in form 3.

Not sure if this is soley html or if javascript is included.

Thanks.
0
rmkpt
Asked:
rmkpt
1 Solution
 
jessegivyDeveloperCommented:
Go ahead and post your code, I'll fix ya up!  :)
0
 
ClickCentricCommented:
Javascript isn't needed, you could go server-side, but javascript is easier:

<script type="text/javascript">
function fieldcalcs() {
document.getElementById('field3').value = document.getElementById('field1').value * document.getElementById('field2').value;
return false;
}
</script>
<form id="form1" name="form1" method="post" action="">
  Field 1
  <input type="text" id="field1" name="field1" />
  <br />
Field 2
<input type="text" id="field2" name="field2" />
<br />
Field 3 (Field 1 x Field 2)
<input type="text" id="field3" name="field3" />
<br />
<input name="Calculate" type="Button" onclick="fieldcalcs();" value="Submit" />
</form>
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now