/    Sign up×
Community /Pin to ProfileBookmark

Order Form will not calculate – newbie – Please help.

Here is the code from my order form. When I press Calculate I get this $NaN instead of the actual total.

Here is the URL to my order form: [url]https://www.helpmagician.com/order.htm[/url]

The calculation code is here if you don’t have to view all of the code on my order form:

<td width=”100%” align=”Left” valign=”top”>
<p align=”left” style=” margin: 0″>
<p align=”left” style=” margin: 0″><INPUT TYPE=”BUTTON” NAME=”CalculateTotal” VALUE=”Calculate Total” onclick=CalcTotal(this.form);><INPUT TYPE=”TEXT” NAME=”TotalAmt” SIZE=10 MAXLENGTH=60>

</tr>
</p>

My order form is up and running but customers are unable to see their order total.

Thank you!!!!
StateLines

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@TheBearMayMar 18.2004 — Haven't verified it yet, but my guess is that the substrings in the lines that read:

orderamt += itemname.substring(numvalue+3,numusers) * doc.forms[0].elements[elemnum].value;

shipamt += shipname.substring(numvalue+1,numusers) *
itemname.substring(numusers+1);

are causing your problem. May need to use eval() or parseFloat().
Copy linkTweet thisAlerts:
@statelinesauthorMar 18.2004 — Dear TheBearMay:

Thank you for your suggestion:

<<Haven't verified it yet, but my guess is that the substrings in the lines that read:

orderamt += itemname.substring(numvalue+3,numusers) * doc.forms[0].elements[elemnum].value;

shipamt += shipname.substring(numvalue+1,numusers) *
itemname.substring(numusers+1);

are causing your problem. May need to use eval() or parseFloat().>>

However, I am very, very ignorant when it comes to javascript. I don't quiet understand what you mean by use eval() or parseFloat().

Am I supposed to be replacing something with a "()" only?

So sorry for my ignorance and would greatly appreciate your reply back.

PS: I have tried to change some of my code and I'm now getting a blank total instead of the N$aN item in the total field. UGH.

Thank you,

StateLines
Copy linkTweet thisAlerts:
@TheBearMayMar 18.2004 — Try:

orderamt += eval(itemname.substring(numvalue+3,numusers)) * doc.forms[0].elements[elemnum].value;

or


orderamt += parseFloat(itemname.substring(numvalue+3,numusers)) * doc.forms[0].elements[elemnum].value;
Copy linkTweet thisAlerts:
@statelinesauthorMar 18.2004 — Thank you TheBearMay.

I tried both of your suggestions and when I click my calculate button, there is no amount in the specified total field.

I'm almost at the verge of tears about now...I have no hair left on my head...LOL.

If you wouldn't mind checking out my source code on my order form again, it is: https://www.helpmagician.com/order.htm

I must've really screwed something up.

So happy that you are responding to my replies and very grateful.

Sincerely,

StateLines
Copy linkTweet thisAlerts:
@TheBearMayMar 18.2004 — I made a few minor changes and I think it's working. See attached.

[upl-file uuid=b5efbfd2-718e-4466-a347-89780347405a size=7kB]order.zip[/upl-file]
Copy linkTweet thisAlerts:
@statelinesauthorMar 19.2004 — Dear TheBearMay:

THANK YOU SO MUCH!!!! It not only works, it works perfect!!!!

I hope someday I can help you as much as you've just helped me.

I am sincerely grateful!!!!!

StateLines
×

Success!

Help @statelines 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.17,
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,
)...