/    Sign up×
Community /Pin to ProfileBookmark

need to calculate after field data changed by radio button

Hi

i have a web page with too much code to post here. and i am having a hard time extracting a working sample.

basically, i have fields that result in an on-the-fly calculation. as the user works on the web page calcs are made prior to submission of the form

I use a radio button to toggle between two choices, and once i click on that, the relevant value infills two particular field

now the code to calculate works fine, but, and this is the reason for my post, only if the user manually inputs into a field, any one, it doesnt matter.

so even though my radio button code gets the desired data to fill in the awaiting fields, upon entry, the other field that is supposed to calculate the data in the fields the radio button brought in wont calculate, and i am trying to find the code so that when i click on the radio button, and the requested data fill in the field below, the calc filed will calculate without the user having to scroll up the page and manually enter a number somewhere just to trigger the calculation

here is the layout”

field a + field b
field c + field d

field e = field a + field c
field f = field b + field d

radio button copies :

field e to field i
field f to field j

then, finally,

field k = field i + field j

in this case, if i click on the radio button, the data falls in nicely, but it wont automatically calculate. Field K will remain blank

but once the radio button places the data in i and j, if i enter data in any of the other fields, field k calculates

how can i get it so that when i click on the radio button and the data hits the respective fields, how can i get it to calculate on that event?

thanks!

to post a comment
HTML

2 Comments(s)

Copy linkTweet thisAlerts:
@MrSnowDropApr 06.2011 — Sorry but the code is necessary to understand, check and clearing up any question about it.

However, a link to the page could be very useful here.
Copy linkTweet thisAlerts:
@inosentauthorApr 06.2011 — Hi

here is the link

http://inovacapitalmanagement.com/apdf/1003o.php

it is the section near the bottom under 'income Analysis' where you see the radio button section

i have one field in the 'Total' section (3rd one down) where it is supposed to be the sum of the borrower's gross and co-borrower's gross.

as you enter numbers above in the income fields everything fires nicely, the math is right, etc.

but what i want is when i click on the radio button the calc fires. for some reason it wont, only if i go back up the page and enter data in a field that calcs. so i dont get that.

most of the code is javascript (the part that calcs) so the source code is all there for the most part. its somewhat of a jungle, but it is as clean as i can get it for now

thanks for the reply
×

Success!

Help @inosent spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...