Contact Us Forum Rules Search Archive
WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Site Design > Graphics & Design Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Graphics & Design Discussion Forum Post your graphics design questions/comments/ideas in here. Ask questions, post tutorials, discuss trends and best practices. Sub-forum for website accessibility and usability.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-31-2006, 09:35 PM
WebProWorld New Member
 

Join Date: Mar 2006
Posts: 1
wafleming RepRank 0
Default Help with color choice check box programming

I am trying to program a site for a friend that needs to offer a product that can come in your pick of 2 colors out of 6 color options. So you pick red or blue etc. out of red,blue,green,black etc. How do I program the check boxes to only allow 2 colors. So if they select a third color thier first check box unselects and thier new check box is now selected.

I can't use radio buttons, because he is using Mals-e
as a shopping cart, and it only seems to accept one radio button???
Reply With Quote
  #2 (permalink)  
Old 04-02-2006, 06:42 PM
WebProWorld New Member
 

Join Date: Oct 2005
Posts: 7
Sbabb RepRank 0
Default

As far as I know, all radio buttons allow only one selection. The term came from the old style car radios with mechanical buttons. When you pushed one button, it popped out the other button that had previously been pushed. Only one button could be depressed at a time.

You might be able to do this with JavaScript or some other variety of scripting. It's a more serious programming task than you can accomplish with straight HTML.

Alternately, you might be able to create two radio button lists, one for "Color #1" and one for "Color #2" but that would let the user select the same color for both "Color #1" and "Color #2" which may or may not be a problem in your situation.


Scott
__________________
How To Avoid Discount Laptop PC Scams - Free Article
4 Things You Need To Know About Online Cash Advances - Free Article
Reply With Quote
  #3 (permalink)  
Old 04-03-2006, 06:14 PM
bj's Avatar
bj bj is offline
WebProWorld 1,000+ Club
 

Join Date: Apr 2005
Location: Delaware Valley, PA
Posts: 1,186
bj RepRank 2bj RepRank 2
Default

The simplest answer is to put all possible two color combinations in the dropdown choices.
Reply With Quote
  #4 (permalink)  
Old 04-03-2006, 06:38 PM
mark3738's Avatar
WebProWorld New Member
 

Join Date: Jul 2003
Location: New Zealand
Posts: 24
mark3738 RepRank 0
Default

I would also suggest using the two lists, but add an error check so that people can't add two colours e.g. Something like if box1 colour1 = box2 colour1 Alert("please choose different colours")
I haven't worked with Mals ecart so am unsure how much control you have, but a simple javascript alert could do this for you.

Another option is to use a 'chained select', which allows certain fields according to what is selected in the first field, but is probably overkill for this scenario.
__________________
Creating affordable website & eCommerce solutions for NZ businesses, clubs and orgs.
http://www.medlicottdesign.orconhosting.net.nz
Reply With Quote
  #5 (permalink)  
Old 04-03-2006, 09:32 PM
Keimos's Avatar
WebProWorld Veteran
 

Join Date: Jul 2003
Location: United Kingdom
Posts: 491
Keimos RepRank 0
Default Help with color choice check box programming

Hi wafleming,

You have probably gone though this but show the graphics for all choices and put the necessary tick box against them all.

Colour is choice and if I were looking I would want to see them.

Keimos
__________________
Keimos - Always learning something new each day
www.keimos.co.uk , www.keimos.net , www.selfpacedit.co.uk
Reply With Quote
  #6 (permalink)  
Old 04-04-2006, 02:09 AM
sands's Avatar
WebProWorld Veteran
 

Join Date: Sep 2005
Location: Kerala, India
Posts: 397
sands RepRank 1
Default

I think the best thing for you would be JavaScript. Check out the following script:
================================================== =


<HEAD>

<SCRIPT LANGUAGE="JavaScript">






<!-- Begin
function countChoices(obj) {
max = 2; // max. number allowed at a time

box1 = obj.form.box1.checked; // your checkboxes here
box2 = obj.form.box2.checked;
box3 = obj.form.box3.checked; // add more if necessary

count = (box1 ? 1 : 0) + (box2 ? 1 : 0) + (box3 ? 1 : 0);
// If you have more checkboxes on your form
// add more (box_ ? 1 : 0) 's separated by '+'

if (count > max) {
alert("Oops! You can only choose up to " + max + " choices! \nUncheck an option if you want to pick another.");
obj.checked = false;
}
}
// End -->
</script>
</HEAD>



<BODY>

<center>
<form>
Please choose up to 2 sections:



<input type=checkbox name=box1 onClick="countChoices(this)">Section 1



<input type=checkbox name=box2 onClick="countChoices(this)">Section 2



<input type=checkbox name=box3 onClick="countChoices(this)">Section 3



</form>
</center>
================================================== =
The instructions are easy to understand and so you would not find any problems modifying it to suit your needs.
All the best, cheerio!
__________________
My Nook | My Biz | My Photos
Reply With Quote
Reply

  WebProWorld > Site Design > Graphics & Design Discussion Forum
Tags: , , , , ,



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0