From bc2e8b649e6ad9afd2cc41e1be20ad952a737619 Mon Sep 17 00:00:00 2001 From: Len Kranendonk Date: Mon, 26 Jul 2004 09:45:34 +0000 Subject: [PATCH] bugfix: default value only worked for select list fields --- docs/changelog/6.x.x.txt | 1 + lib/WebGUI/Operation/Profile.pm | 5 ++++- lib/WebGUI/Operation/ProfileSettings.pm | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index 46c983cd6..a5facb77f 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -16,6 +16,7 @@ statistics. (Thanks to DonorWare for funding this feature.) - Fixed a typo in Forum/UI.pm - bugfix [ 996284 ] Compile error in macro.pm + - bugfix [ 997918 ] Default value in profile not working 6.1.1 - bugfix [ 991313 ] Manage Translations doesn't work diff --git a/lib/WebGUI/Operation/Profile.pm b/lib/WebGUI/Operation/Profile.pm index 546acbf81..1b3df18e7 100644 --- a/lib/WebGUI/Operation/Profile.pm +++ b/lib/WebGUI/Operation/Profile.pm @@ -65,7 +65,10 @@ sub getRequiredProfileFields { $default = $session{form}{$data->{fieldName}}; } elsif (exists $session{user}{$data->{fieldName}}) { $default = $session{user}{$data->{fieldName}}; - } + } else { + $default = $data->{dataDefault}; + } + my $cmd = 'WebGUI::Form::'.$method.'({"name"=>$data->{fieldName},"value"=>$default})'; $hash{'profile.formElement'} = eval($cmd); diff --git a/lib/WebGUI/Operation/ProfileSettings.pm b/lib/WebGUI/Operation/ProfileSettings.pm index e2107d5a7..78e8b5683 100644 --- a/lib/WebGUI/Operation/ProfileSettings.pm +++ b/lib/WebGUI/Operation/ProfileSettings.pm @@ -228,7 +228,7 @@ sub www_editProfileFieldSave { $session{form}{fieldLabel} = 'Unamed' if ($session{form}{fieldLabel} eq "" || $session{form}{fieldLabel} eq "''"); $test = eval($session{form}{fieldLabel}); $session{form}{fieldLabel} = "'".$session{form}{fieldLabel}."'" if ($test eq ""); - if ($session{form}{dataDefault} ne "") { + if ($session{form}{dataDefault} && $session{form}{dataType}=~/List$/) { unless ($session{form}{dataDefault} =~ /^\[/) { $session{form}{dataDefault} = "[".$session{form}{dataDefault}; }