Validating Radio Buttons in two directions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm kind of a newbie so speak sllllooooowly.


I've got a problem with validating radio buttons that seems to be harder
than I think to solve.   I've got ten items set up like this:

Green: <input type="Radio" name="color1" value="1" /> <input type="Radio"
name="color1" value="2" /> <input type="Radio" name="color1" value="3" />
and son on out to 10.

Then I've got Red: <input type="Radio" name="color2" value="1" /> and so on
out to ten again.

So I've got ten colors each with 10 radio buttons so that they can be ranked
from 1 to 10.  The problem?  Well, obviously, the user can only pick one
value in the row for each color.  That part is simple.  BUT  I also need to
make sure that they only rank one color with the value "1" and, of course,
only one color can have "2" and so on.  How do I validate this so that they
get a warning before they submit that user has picked more one color with
the same ranking?

An additional complication:  They don't have to answer or rank all the
colors.  All they really need to do is rank one color to copmplete the
question.

I created an array with the answers and then used array_count_values to find
out the frequency but that chokes on color rankings that are left blank.

How do I assure that only one color is ranked at any one value?

I hope my question makes sense.  Any help will be appreciated.

Thanks in advance.

HiFi Tubes

a retro kinda' guy who values quality over convenience

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux