Feedback: irt.org FAQ Knowledge Base Q48
Feedback on: irt.org FAQ Knowledge Base Q48
Sent by Paul Sapsara on September 03, 1999 at 15:35:44: - feedback #430
Length: Too short
Comments: This is just a small piece of the code. How do you parse it in the HTML? If I had ten text fields with numbers entered in each, and the user hit a "submit" button, how do I pass the total to a text box? Paul
Sent by Wayne on September 09, 1999 at 11:29:51: - feedback #446
Worth: Very worth reading
Comments: Thanks, quickly found the answer for which I was looking. Great Job!
Sent by Chris Kelley on December 14, 2000 at 00:30:00: - feedback #2147
Worth: Very worth reading
Length: Just right
Comments: But... it still doesn't say how to actually sum form fields... Where Q1 through Q3 are radio buttons each with values 1 through 4, this code produces NaN. function validate_form() { a = document.form.Q1.value; b = document.form.Q2.value; c = document.form.Q3.value; total = a + b + c; alert ("Total = " + total); return validity; }
Sent by billemery on March 27, 2001 at 16:23:43: - feedback #2547
Length: Too short
Comments: this is an example of how to do what the question asks. first the form variables are convertd to numbers ie var QDT = DAILYFORM.QTYDAILYTICKETS.value - 0; then the calc is done and the result is loaded back into a form text field by using + ''. function calcdepqty() { var result = 0; var QDT = 0; var QN = 0; var VBQ = 0; var V = 0; var WEQ = 0; var QDT = DAILYFORM.QTYDAILYTICKETS.value - 0; var WEQ = DAILYFORM.WEQTY.value - 0; var QN = DAILYFORM.QTYNIGHT.value - 0; var VBQ = DAILYFORM.VALIDBILLQTY.value - 0; var V = DAILYFORM.VOID.value - 0; result = QDT + WEQ + QN + VBQ + V; DAILYFORM.DEPOSITQTY.value = result + ''; } </SCRIPT>
|