X-Git-Url: http://git.shiar.net/perl/html-form-simple.git/blobdiff_plain/061e1dbc2abe6c89b90348e22e5f3455a2b8328d..47c6a0e47426e447523d4697b2fb596366f7f9d4:/lib/HTML/Form/Simple.pm
diff --git a/lib/HTML/Form/Simple.pm b/lib/HTML/Form/Simple.pm
index 7d02314..a722151 100644
--- a/lib/HTML/Form/Simple.pm
+++ b/lib/HTML/Form/Simple.pm
@@ -33,7 +33,7 @@ sub tag {
# strip empty if it shouldn't be
defined $attr->{$_} and $attr->{$_} eq '' and delete $attr->{$_}
- for qw(id type class style);
+ for qw(id for type class style);
my $return = '<' . $tag;
@@ -248,6 +248,24 @@ sub check {
$self->select($name, $rows, {%$attr, type => 'checkbox'});
}
+sub row {
+ my $self = shift;
+ my ($name, $contents, $attr) = $self->_attr(2, @_);
+
+ $contents = defined $contents && ref $contents ne 'HASH'
+ ? $self->quote($contents) : $self->text($name, $contents);
+ my $label = defined $attr->{label}
+ ? $self->quote(delete $attr->{label})
+ : defined $name ? $self->quote($name) : '';
+
+ return $self->tag(label => {for => $name, %$attr})
+ . $label
+ . ''
+ . (defined $, ? $, : ' ')
+ . $contents
+ ;
+}
+
1;
__END__