Getting data to fill a form

Posted on 2006-05-30
Last Modified: 2010-04-06
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.

Question by:rmkpt
    LVL 12

    Expert Comment

    Go ahead and post your code, I'll fix ya up!  :)
    LVL 10

    Accepted Solution

    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;
    <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" />

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
    I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
    Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
    The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now