s/y+/\%Y/gi;
} $::myconfig{"dateformat"};
- my $cal_align = delete $params{cal_align} || 'BR';
+ my $cal_align = delete $params{cal_align} || 'BR';
+ my $onchange = delete $params{onchange};
my $str_value = blessed $value ? $value->to_lxoffice : $value;
$self->input_tag($name, $str_value,
size => 11,
title => _H($::myconfig{dateformat}),
onBlur => 'check_right_date_format(this)',
+ ($onchange ? (
+ onChange => $onchange,
+ ) : ()),
%params,
- ) . ((!$params{no_cal}) ?
+ ) . ((!$params{no_cal} && !$params{readonly}) ?
$self->html_tag('img', undef,
src => 'image/calendar.png',
alt => $::locale->text('Calendar'),
my ($self, $name, $value, @slurp) = @_;
my %attributes = _hashify(@slurp);
- my $rows = delete $attributes{rows} || 1;
+ my ($rows, $cols);
my $min = delete $attributes{min_rows} || 1;
+ if (exists $attributes{cols}) {
+ $cols = delete $attributes{cols};
+ $rows = $::form->numtextrows($value, $cols);
+ } else {
+ $rows = delete $attributes{rows} || 1;
+ }
+
return $rows > 1
- ? $self->textarea_tag($name, $value, %attributes, rows => max $rows, $min)
- : $self->input_tag($name, $value, %attributes);
+ ? $self->textarea_tag($name, $value, %attributes, rows => max($rows, $min), ($cols ? (cols => $cols) : ()))
+ : $self->input_tag($name, $value, %attributes, ($cols ? (size => $cols) : ()));
}
sub multiselect2side {
=item C<areainput_tag $name, $content, %PARAMS>
Creates a generic input tag or textarea tag, depending on content size. The
-mount of desired rows must be given with C<rows> parameter, Accpeted parameters
+amount of desired rows must be either given with the C<rows> parameter or can
+be computed from the value and the C<cols> paramter, Accepted parameters
include C<min_rows> for rendering a minimum of rows if a textarea is displayed.
You can force input by setting rows to 1, and you can force textarea by setting