/    Sign up×
Community /Pin to ProfileBookmark

Script form to do math

I need to create a form that looks like a basic invoice. You choose a size and color, add a quantity, and based on the model number, it puts in a unit price and calculates the info automatically based on quantity. Then it can be submitted via email.

Any ideas where to get a script like this?

I appreciate any help.

Thanks!

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@ExuroDec 14.2004 — You just need to grab the values of the fields, and either parse them to do math with them or equate a number into your equation based on that value. There really isn't much else that can be said without more detail on your problem though. However, you should really at least provide an alternate method for generating the price server-side in case the user does not have JavaScript enabled.
Copy linkTweet thisAlerts:
@JuuitchanDec 14.2004 — Or in case the user is smarter than you. JavaScript being client-side, can't the user save the form to her hard drive and then modify it at will?
Copy linkTweet thisAlerts:
@ExuroDec 14.2004 — [i]Originally posted by Juuitchan [/i]

[B]can't the user save the form to her hard drive and then modify it at will? [/B][/QUOTE]

That's why you do the calculations server-side. You can do the initial calculations client-side to save on server resources, but the final number should always be done by the server to avoid users hacking.
×

Success!

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