[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] Check Box Limits
>
> I need a set of check boxes but I need to allow only 2 choices... Is this
> possible?
>
> Example:
> Choose from the following (2 choices only):
>
> Select Box 1
> Select Box 2
> Select Box 3
>
> I assume if it's possible, this is setup in order.profile just can't find
> any info in IC Developers Resource and need help with the code.
>
You could try something like this in your profile:
[calc]
my @choices = split(/\0/,$CGI->{yourselect});
if (scalar @choices > 2){
$Session->{errors}->{yourselect} = 'I said 2 choices only, dammit';
}
undef;
[/calc]
I'd avoid JavaScript if I were you, as people can just switch it off.
Of course, you could use both. Just don't rely on JS to actually do
the job.
--
_/ _/ _/_/_/_/ _/ _/ _/_/_/ _/ _/
_/_/_/ _/_/ _/ _/ _/ _/_/ _/ K e v i n W a l s h
_/ _/ _/ _/ _/ _/ _/ _/_/ kevin@cursor.biz
_/ _/ _/_/_/_/ _/ _/_/_/ _/ _/