Skip to content
Permalink
Browse files

Item9007: Fix Foswiki::Form validation problems

SMELL: We force CGI::radio_group() to use HTML3 tables to layout buttons

git-svn-id: http://svn.foswiki.org/trunk@7634 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information...
PaulHarvey PaulHarvey
PaulHarvey authored and PaulHarvey committed Jun 5, 2010
1 parent 5dd044d commit dba0cf84bee97e71ffa7680aaa1d08bf1ddabea3
Showing with 7 additions and 5 deletions.
  1. +3 −3 core/lib/Foswiki/Form/Checkbox.pm
  2. +3 −1 core/lib/Foswiki/Form/Radio.pm
  3. +1 −1 core/lib/Foswiki/Form/Select.pm
@@ -50,14 +50,14 @@ sub renderForEdit {
my @defaults;
foreach my $item ( @{ $this->getOptions() } ) {

# NOTE: Does not expand $item in label
# NOTE: Does not expand $item in title
$attrs{$item} = {
class => $this->cssClasses('foswikiCheckbox'),
label => $topicObject->expandMacros($item),
title => $topicObject->expandMacros($item),
};

if ( $isSelected{$item} ) {
$attrs{$item}{checked} = 'checked';
# CGI::checkbox_group() will check these items
push( @defaults, $item );
}
}
@@ -13,6 +13,8 @@ sub new {
$this->{size} ||= 0;
$this->{size} =~ s/\D//g;
$this->{size} ||= 0;
# SMELL: Non-zero -columns attribute forces CGI::radio_group() to use
# HTML3 tables for layout
$this->{size} = 4 if ( $this->{size} < 1 );

return $this;
@@ -27,7 +29,7 @@ sub renderForEdit {
foreach my $item ( @{ $this->getOptions() } ) {
$attrs{$item} = {
class => $this->cssClasses('foswikiRadioButton'),
label => $topicObject->expandMacros($item)
title => $topicObject->expandMacros($item)
};

$selected = $item if ( $item eq $value );
@@ -120,7 +120,7 @@ sub renderForEdit {
size => $this->{size},
};
if ( $this->isMultiValued() ) {
$params->{'multiple'} = 'on';
$params->{'multiple'} = 'multiple';
$value = CGI::Select( $params, $choices );

# Item2410: We need a dummy control to detect the case where

0 comments on commit dba0cf8

Please sign in to comment.
You can’t perform that action at this time.