Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CGI CPAN distribution.

Report information
The Basics
Id: 26917
Status: resolved
Priority: 0/
Queue: CGI

People
Owner: MARKSTOS [...] cpan.org
Requestors: heiko [...] wecos.de
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: wishlist: missing attribute for labels of checkbox_group and radio_group
Date: Thu, 03 May 2007 15:50:24 +0200
To: bug-CGI.pm [...] rt.cpan.org
From: Heiko Weber <heiko [...] wecos.de>
Hi all, with the -attributes parameter we can define css attributes for checkboxes or radiobuttons. I would like to put a new parameter -label_attributes onto the wishlist, which contains attributes for the created <label></label>. Cheers Heiko
Download smime.p7s
application/x-pkcs7-signature 3.2k

Message body not shown because it is not plain text.

From: Heiko Weber
Hi, in the meantime I patched these attributes into 3.29 myself, if you agree, it is easier for you to add this into the next version. I also added the "labelattributes" to the checkbox-label. Cheers Heiko
*** CGI.pm-orig Tue Oct 9 14:05:00 2007 --- CGI.pm Tue Oct 9 14:35:46 2007 *************** *** 2145,2156 **** #### 'checkbox' => <<'END_OF_FUNC', sub checkbox { my($self,@p) = self_or_default(@_); ! my($name,$checked,$value,$label,$override,$tabindex,@other) = ! rearrange([NAME,[CHECKED,SELECTED,ON],VALUE,LABEL,[OVERRIDE,FORCE],TABINDEX],@p); $value = defined $value ? $value : 'on'; if (!$override && ($self->{'.fieldnames'}->{$name} || defined $self->param($name))) { --- 2145,2157 ---- #### 'checkbox' => <<'END_OF_FUNC', sub checkbox { my($self,@p) = self_or_default(@_); ! my($name,$checked,$value,$label,$labelattributes,$override,$tabindex,@other) = ! rearrange([NAME,[CHECKED,SELECTED,ON],VALUE,LABEL,LABELATTRIBUTES, ! [OVERRIDE,FORCE],TABINDEX],@p); $value = defined $value ? $value : 'on'; if (!$override && ($self->{'.fieldnames'}->{$name} || defined $self->param($name))) { *************** *** 2163,2173 **** $value = $self->escapeHTML($value,1); $the_label = $self->escapeHTML($the_label); my($other) = @other ? "@other " : ''; $tabindex = $self->element_tab($tabindex); $self->register_parameter($name); ! return $XHTML ? CGI::label(qq{<input type="checkbox" name="$name" value="$value" $tabindex$checked$other/>$the_label}) : qq{<input type="checkbox" name="$name" value="$value"$checked$other>$the_label}; } END_OF_FUNC --- 2164,2175 ---- $value = $self->escapeHTML($value,1); $the_label = $self->escapeHTML($the_label); my($other) = @other ? "@other " : ''; $tabindex = $self->element_tab($tabindex); $self->register_parameter($name); ! return $XHTML ? CGI::label($labelattributes, ! qq{<input type="checkbox" name="$name" value="$value" $tabindex$checked$other/>$the_label}) : qq{<input type="checkbox" name="$name" value="$value"$checked$other>$the_label}; } END_OF_FUNC *************** *** 2325,2339 **** '_box_group' => <<'END_OF_FUNC', sub _box_group { my $self = shift; my $box_type = shift; ! my($name,$values,$defaults,$linebreak,$labels,$attributes, ! $rows,$columns,$rowheaders,$colheaders, $override,$nolabels,$tabindex,$disabled,@other) = ! rearrange([ NAME,[VALUES,VALUE],[DEFAULT,DEFAULTS],LINEBREAK,LABELS,ATTRIBUTES, ! ROWS,[COLUMNS,COLS],[ROWHEADERS,ROWHEADER],[COLHEADERS,COLHEADER], [OVERRIDE,FORCE],NOLABELS,TABINDEX,DISABLED ],@_); my($result,$checked,@elements,@values); --- 2327,2341 ---- '_box_group' => <<'END_OF_FUNC', sub _box_group { my $self = shift; my $box_type = shift; ! my($name,$values,$defaults,$linebreak,$labels,$labelattributes, ! $attributes,$rows,$columns,$rowheaders,$colheaders, $override,$nolabels,$tabindex,$disabled,@other) = ! rearrange([ NAME,[VALUES,VALUE],[DEFAULT,DEFAULTS],LINEBREAK,LABELS,LABELATTRIBUTES, ! ATTRIBUTES,ROWS,[COLUMNS,COLS],[ROWHEADERS,ROWHEADER],[COLHEADERS,COLHEADER], [OVERRIDE,FORCE],NOLABELS,TABINDEX,DISABLED ],@_); my($result,$checked,@elements,@values); *************** *** 2391,2401 **** my $tab = $tabs{$_}; $_=$self->escapeHTML($_); if ($XHTML) { push @elements, ! CGI::label( qq(<input type="$box_type" name="$name" value="$_" $checkit$other$tab$attribs$disable/>$label)).${break}; } else { push(@elements,qq/<input type="$box_type" name="$name" value="$_"$checkit$other$tab$attribs$disable>${label}${break}/); } } --- 2393,2403 ---- my $tab = $tabs{$_}; $_=$self->escapeHTML($_); if ($XHTML) { push @elements, ! CGI::label($labelattributes, qq(<input type="$box_type" name="$name" value="$_" $checkit$other$tab$attribs$disable/>$label)).${break}; } else { push(@elements,qq/<input type="$box_type" name="$name" value="$_"$checkit$other$tab$attribs$disable>${label}${break}/); } }
See also bug #11789.
From looking at the source of 3.43, it looks like this patch was previously applied. Marking as resolved. Mark