forward port from branch_6_7

This commit is contained in:
Colin Kuskie 2005-11-01 19:35:17 +00:00
parent eb3024ca7e
commit 6c9f51ccd3
2 changed files with 13 additions and 2 deletions

View file

@ -80,6 +80,11 @@ The starting value for the field.
If no starting value is specified, this will be used instead.
=head4 _defaulted
This flag indicates that the defaultValue was used. It is used by Form types that support
an initial blank field, instead of using a default, like WebGUI::Form::Date.pm
=head4 extras
Add extra attributes to the form tag like
@ -146,6 +151,9 @@ sub definition {
defaultValue=>{
defaultValue=>undef
},
_defaulted=>{
defaultValue=>0
},
label=>{
defaultValue=>undef
},
@ -353,8 +361,11 @@ sub new {
}
}
# if the value field is undefined, lets use the defaultValue field instead
# the _defaulted field is used to tell form fields that support noDate/noValue
# options whether the field can be safely cleared or not.
unless (exists $params{value}) {
$params{value} = $params{defaultValue};
$params{_defaulted} = 1;
}
# doesn't have an id specified, so let's give it one
unless ($params{id}) {

View file

@ -61,7 +61,7 @@ Defaults to 10. The displayed size of the box for the date to be typed in.
=head4 noDate
By default a date is placed in the value field. Set this to "1" to leave it empty.
A default date is placed in the value field. Set this to "1" to leave it empty.
=head4 defaultValue
@ -125,7 +125,7 @@ Renders a date picker control.
sub toHtml {
my $self = shift;
if ($self->{noDate} ) {
if ($self->{_defaulted} && $self->{noDate} ) {
$self->{value} = '';
}
else {