/    Sign up×
Community /Pin to ProfileBookmark

form fields in fuctions

I am trying to recalculate some fields in a form (convert them to currency and add taxes) but I am stumped. What I have works in IE7 but not FF3. I have the following:

I have the user enter a number in a form (called payform) and a field called “amount”. There are also fields called “tax” and “total”.

the user enters the “amount” and presses a button “calculate”. The “onclick” method of the button calls a function Calculate_values(payform.amount.value). The function is defined in the header as:

function Calculate_values(Atext)
{
var A = parseFloat(Atext);
payform.amount.value=A;
payform.tax.value = A * 0.05775;
payform.total.value= A *
1.05775;
}

This works fine in IE7, but not in FF3.

I think FF can not identify the form field to enter the values into. How do I do that?

to post a comment
HTML

2 Comments(s)

Copy linkTweet thisAlerts:
@gil_davisNov 05.2009 — How do I do that? [/quote]Fully define the field, e.g.:[color=red]document.[/color]payform.amount.value=A;[/quote]
Copy linkTweet thisAlerts:
@nunofyer_bznessauthorNov 05.2009 — Duhhh.

Now I'm embarrassed to have posted this question .... ?

Thanks. that did solve the problem.
×

Success!

Help @nunofyer_bzness 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 5.20,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...