/    Sign up×
Community /Pin to ProfileBookmark

Limit Selection Customers Choose

Hello All!

I’m very new to HTML, JavaScript, PHP, etc. I am practically a newbie, but I’m a quick learner. I’m creating a page that will have various colors listed as checkboxes. I want to limit the number of choices to 2 colors per order. How do I right the code for that? I have searched throughout the Internet and have not located what I’m looking for.

Also, if the customer does try to make more than 2 selections I would like to create an alert, or warning, or something that will pop-up and state they have exceeded their limit or something to that effect.

Help please ? I have included the code at the bottom.

<html>
<body>
Vander Light Candles – Colors
<br>
***Limit 2 choices***

<table border=”0″ width=”50%” cellpadding=”10″>
<tr>
<td width=”30%” valign=”top”>

<form action=””>
Baby Blue
<input type=”checkbox” name=”colors” value=”Baby Blue”/>
<br>
Black
<input type=”checkbox” name=”colors” value=”Black”/>
<br>
Blue
<input type=”checkbox” name=”colors” value=”Blue”/>
<br>
Bright Yellow
<input type=”checkbox” name=”colors” value=”Bright Yellow”/>
<br>
Brown
<input type=”checkbox” name=”colors” value=”Brown”/>
<br>
Burgundy
<input type=”checkbox” name=”colors” value=”Burgundy”/>
<br>
Cinnamon Spice
<input type=”checkbox” name=”embeds” value=”Cinnamon Spice”/>
</td>

<td width=”30%” valign=”top”>
<form action=””>
Clear
<input type=”checkbox” name=”colors” value=”Clear”/>
<br>
Golden Yellow
<input type=”checkbox” name=”colors” value=”Golden Yellow”/>
<br>
Hunter Green
<input type=”checkbox” name=”colors” value=”Hunter Green”/>
<br>
Kelly Green
<input type=”checkbox” name=”colors” value=”kelly Green”/>
<br>
Light Purple
<input type=”checkbox” name=”colors” value=”Light Purple”/>
<br>
Magenta
<input type=”checkbox” name=”colors” value=”Magenta”/>
<br>
Navy Blue
<input type=”checkbox” name=”colors” value=”Navy Blue”/>
</td>

<td width=”30%” valign=”top”>
<form action=””>
Orange
<input type=”checkbox” name=”colors” value=”Orange”/>
<br>
Peach
<input type=”checkbox” name=”colors” value=”Peach”/>
<br>
Pink
<input type=”checkbox” name=”colors” value=”Pink”/>
<br>
Pumpkin Spice
<input type=”checkbox” name=”colors” value=”Pumpkin Spice”/>
<br>
Purple
<input type=”checkbox” name=”colors” value=”Purple”/>
<br>
Red
<input type=”checkbox” name=”colors” value=”Red”/>
<br>
Teal
<input type=”checkbox” name=”colors” value=”Teal”/>
</tr>
</table>
</body>
</html>

to post a comment
HTML

1 Comments(s)

Copy linkTweet thisAlerts:
@ray326Aug 19.2007 — (Deleted rambling) You can scan the inputs with Javascript or you can run a counter off the onchange event of each checkbox. You'll still have to test it on the server once they post the form because they may no have Javascript enabled.
×

Success!

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