Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - adding up checkbox values
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

adding up checkbox values

 Post Reply Post Reply
Author
mike7510uk View Drop Down
Newbie
Newbie


Joined: 05 October 2006
Location: United Kingdom
Status: Offline
Points: 21
Post Options Post Options   Thanks (0) Thanks(0)   Quote mike7510uk Quote  Post ReplyReply Direct Link To This Post Topic: adding up checkbox values
    Posted: 20 October 2006 at 4:39pm
I have 4 checkboxes on a page with different values for each, if the user selects any (or all) of the boxes i want a label to display the total amount, i have got the label to display any 1 value but cant add it all up. Any ideas?
 
 
Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post Posted: 20 October 2006 at 8:01pm
Kind of depends upon if you want to use javascript to update the label in place, or if you want to make a trip back to the server.

Also depends if the check boxes are part of a group, and all have the same name, or if they each have a different name. If a group, you'd treat them like an array.

Lead me not into temptation... I know the short cut, follow me.
Back to Top
mike7510uk View Drop Down
Newbie
Newbie


Joined: 05 October 2006
Location: United Kingdom
Status: Offline
Points: 21
Post Options Post Options   Thanks (0) Thanks(0)   Quote mike7510uk Quote  Post ReplyReply Direct Link To This Post Posted: 23 October 2006 at 9:05am
the check boxes are not part of a group. if the user checks checkbox 1 i want the label to disply a value, if the user uncecks the box, clear the value. Also, if the user checks 1 or more, add up all the value (subtracting if the box is unchecked)
Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post Posted: 23 October 2006 at 9:16pm
As you're changing the display on the users machine, you'd need to use javascript. There's probably scripts available for doing something like this on the scripting sites.

Lead me not into temptation... I know the short cut, follow me.
Back to Top
mike7510uk View Drop Down
Newbie
Newbie


Joined: 05 October 2006
Location: United Kingdom
Status: Offline
Points: 21
Post Options Post Options   Thanks (0) Thanks(0)   Quote mike7510uk Quote  Post ReplyReply Direct Link To This Post Posted: 24 October 2006 at 4:21pm
yes i got it working now, using javascript. thanks
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.