in reply to Using labelattributes with CGI's checkbox_group
#!/usr/bin/perl -- use strict; use warnings; use CGI::Pretty; my %labels = ( 'eenie' => 'your first choice', 'meenie' => 'your second choice', 'minie' => 'your third choice' ); print "\n------ broken (the example in the docs), unsurprising, its un +tested ----------\n"; print CGI::Pretty->checkbox_group( 'group_name', [ 'eenie', 'meenie', 'minie', 'moe' ], [ 'eenie', 'moe' ], 'true', \%labels, { 'moe' => { 'class' => 'red' }, 'eenie' => { 'class' => 'yo' }, } ); print "\n----- works (also documented but untested) -----------\n"; print CGI::Pretty->checkbox_group( -name => 'group_name', -values => [ 'eenie', 'meenie', 'minie', 'moe' ], -default => [ 'eenie', 'moe' ], -linebreak => 'true', -labels => \%labels, -attributes => { 'moe' => { 'class' => 'red' }, 'eenie' => { 'class' => 'yo' }, } ); __END__ ------ broken (the example in the docs), unsurprising, its untested -- +-------- <label eenie="HASH(0xa7d7a4)" moe="HASH(0xa7d6b4)"> <input type="checkbox" name="group_name" value="eenie" checked +="checked" />your first choice </label> <br /><label eenie="HASH(0xa7d7a4)" moe="HASH(0xa7d6b4)"> <input type="checkbox" name="group_name" value="meenie" />your + second choice </label> <br /><label eenie="HASH(0xa7d7a4)" moe="HASH(0xa7d6b4)"> <input type="checkbox" name="group_name" value="minie" />your +third choice </label> <br /><label eenie="HASH(0xa7d7a4)" moe="HASH(0xa7d6b4)"> <input type="checkbox" name="group_name" value="moe" checked=" +checked" />moe </label> <br /> ----- works (also documented but untested) ----------- <label> <input type="checkbox" name="group_name" value="eenie" checke +d="checked" class="yo"/>your first choice </label> <br /><label> <input type="checkbox" name="group_name" value="meenie" />you +r second choice </label> <br /><label> <input type="checkbox" name="group_name" value="minie" />your + third choice </label> <br /><label> <input type="checkbox" name="group_name" value="moe" checked= +"checked" class="red"/>moe </label> <br />
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Using labelattributes with CGI's checkbox_group
by richardwfrancis (Beadle) on Feb 26, 2011 at 09:59 UTC |