|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
javascript addition
Author: John Ensign
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:14269#73922
Very good point Isaac!.. .)
---- John
----- Excess quoted text cut - see Original Post for more -----
Hey John, most of the time I agree with you... that is, when you're just
summing up values that a user has given you and getting whatever total they
produce, i.e. for a mortgage app where the user enters their financial info
and all you want to know is their total annual income for their application.
The exception is when the user is entering values which must add up to a
given total which is required by some other external mechanism, i.e. in a
grade-weighting schedule for an electronic report-card where grades for
different types of assignments may be weighted differently, but the sum of
all wieghts must add up to 100 ( making each point in the weighting schedule
exactly 1% ). In order to calculate the percentage, you have to know the
total points, so if you want to double-check the teachers to make sure their
math adds up, you can enforce a 100pt total and you know that if their
numbers don't add up to exactly 100 they need to check their math and make
an adjustment.
I _think_ he may be doing something similar to this, although I'm not
certain of that...
Isaac Dealey
www.turnkey.to
954-776-0046
Author: Chris Lofback
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:14269#73882
JavaScript is case sensitive, so that should be parseInt() rather than
ParseInt().
Chris Lofback
Sr. Web Developer
TRX Integration
28051 US 19 N., Ste. C
Clearwater, FL 33761
www.trxi.com
You might try adding a ParseInt() function around the value as well:
e.g. ParseInt(document.newBillingInfo.SCEPbilledAmount.value) +
ParseInt(document.newBillingInfo.SCEPpenaltyAmount.value)
etc...
Tim P.
----- Excess quoted text cut - see Original Post for more -----
Author: Tim Painter
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:14269#73876
You might try adding a ParseInt() function around the value as well:
e.g. ParseInt(document.newBillingInfo.SCEPbilledAmount.value) +
ParseInt(document.newBillingInfo.SCEPpenaltyAmount.value)
etc...
Tim P.
----- Excess quoted text cut - see Original Post for more -----
Author: S. Isaac Dealey
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:14269#73873
----- Excess quoted text cut - see Original Post for more -----
Hey John, most of the time I agree with you... that is, when you're just
summing up values that a user has given you and getting whatever total they
produce, i.e. for a mortgage app where the user enters their financial info
and all you want to know is their total annual income for their application.
The exception is when the user is entering values which must add up to a
given total which is required by some other external mechanism, i.e. in a
grade-weighting schedule for an electronic report-card where grades for
different types of assignments may be weighted differently, but the sum of
all wieghts must add up to 100 ( making each point in the weighting schedule
exactly 1% ). In order to calculate the percentage, you have to know the
total points, so if you want to double-check the teachers to make sure their
math adds up, you can enforce a 100pt total and you know that if their
numbers don't add up to exactly 100 they need to check their math and make
an adjustment.
I _think_ he may be doing something similar to this, although I'm not
certain of that...
Isaac Dealey
www.turnkey.to
954-776-0046
Author: John Ensign
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:14269#73859
IMHO...
In terms of interface design, its easier to auto-calc amounts, then you kind
of take out the human element...
And if youre involving 10 fields for some kind of calculation, and the value
"they" enter is wrong, how do you point to the incorrect amount in the
appropriate field? (assuming youve already set limits, and checked to make
sure the values, if numeric, are within that range).
Its simpler to auto calc it for them. Although, you should also recheck the
math on the server by re-calculating the field amounts again, just to be
sure. )
hope any of this helps,
John Ensign
Hello,
Can anybody show me how you would I would validate the sum of several text
boxes? This is what I'm trying to use but not having luck.. thanks in
advance.
function validate()
{
if (document.newBillingInfo.SCEPbilledAmount.value +
document.newBillingInfo.SCEPpenaltyAmount.value +
document.newBillingInfo.SCEPdelinquentAmount.value !=
document.newBillingInfo.SCEPtotalAmount.value)
{
alert("The total Billing amount does not add up correctly, Please
check the values.")
document.newBillingInfo.SCEPbilledAmount.focus()
return false;
}
return true;
}
Author: Matthew R. Small
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:14269#73853
Use the function eval() with each textbox value:
Eval(document.newBillingInfo.SCEPbilledAmount.value)
- Matt Small
Hello,
Can anybody show me how you would I would validate the sum of several
text boxes? This is what I'm trying to use but not having luck.. thanks
in advance.
function validate()
{
if (document.newBillingInfo.SCEPbilledAmount.value +
document.newBillingInfo.SCEPpenaltyAmount.value +
document.newBillingInfo.SCEPdelinquentAmount.value !=
document.newBillingInfo.SCEPtotalAmount.value)
{
alert("The total Billing amount does not add up correctly,
Please check the values.")
document.newBillingInfo.SCEPbilledAmount.focus()
return false;
}
return true;
}
Author: Tim Do
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:14269#73850
Hello,
Can anybody show me how you would I would validate the sum of several text
boxes? This is what I'm trying to use but not having luck.. thanks in
advance.
function validate()
{
if (document.newBillingInfo.SCEPbilledAmount.value +
document.newBillingInfo.SCEPpenaltyAmount.value +
document.newBillingInfo.SCEPdelinquentAmount.value !=
document.newBillingInfo.SCEPtotalAmount.value)
{
alert("The total Billing amount does not add up correctly, Please
check the values.")
document.newBillingInfo.SCEPbilledAmount.focus()
return false;
}
return true;
}
|
May 24, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||