/    Sign up×
Community /Pin to ProfileBookmark

Drop down inputs that add up!

Hello there good people of the ‘tinterweb,

I’m trying to find a solution to my ‘bulk’ problem and I’m hoping y’all can help.

I have a ‘buy in bulk’ page on a clients website, and there’s are 5 colourways of the product. The bulk page offers the product in quantities of 25, 50 & 100.

The thing is, at the moment, people make their choice of colourways manually in an input box, but we have to rely on them correctly choosing the right number of colourways i.e they add up to 25.

[URL=http://www.pukme.com/buy-uk.php]http://www.pukme.com/buy-uk.php[/URL] (Click ‘buying in bulk?’ on the left-hand side)

What I need is 5 drop-downs, one for each colourway (Pink, blue, green, white & orange) and I need for some javascript to calculate the correct amount, i.ethose 5 drops downs can only add upto 25, no more and no less.

Is this even possible?

I’ve been searching the interweb but it’s hard to know exactly what to search for!

Many thanks in advance !!

~ Gav.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@tarsusOct 12.2006 — Not really a good way to do that with the way you've got it set up - not unless you create a script that does something like grab the content of the textarea, divide it into an array based on line breaks, get the first character of each line, and add those up.

But with the info in a textarea, the users can delete everything there and enter anything they want. You can't guarantee they'll leave it in the format "1 x Pink"

What would be better is separate text inputs for quantities. For example, under 25x:
[CODE]
Pink: <input type="text" size="2" maxlength="2" name="bulk25pink" /><br />
Blue: <input type="text" size="2" maxlength="2" name="bulk25blue" /><br />[/CODE]


Etc . . .

It would be easy enough to grab the values from those inputs and add them up.
Copy linkTweet thisAlerts:
@konithomimoOct 12.2006 — I agree with tarsus on this one. Although it could be done the way that you want, it is not best to do it that way.
×

Success!

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