From 156de5ea882086138358f23da4435dd44cac0c22 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 12 Dec 2005 18:30:48 +0000 Subject: [PATCH] Make label overrideable in formField so that required fields can be highlighted with an asterisk in the Profile tab for Operation/User.pm --- lib/WebGUI/Operation/User.pm | 3 ++- lib/WebGUI/ProfileField.pm | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/WebGUI/Operation/User.pm b/lib/WebGUI/Operation/User.pm index 2efab3de9..59b534ed4 100644 --- a/lib/WebGUI/Operation/User.pm +++ b/lib/WebGUI/Operation/User.pm @@ -279,7 +279,8 @@ sub www_editUser { $tabform->getTab("profile")->raw(''.$category->getLabel.''); foreach my $field (@{$category->getFields}) { next if $field->getId =~ /contentPositions/; - $tabform->getTab("profile")->raw($field->formField(undef,1)); + my $label = $field->getLabel . ($field->isRequired ? "*" : ''); + $tabform->getTab("profile")->raw($field->formField({label=>$label},1)); } } my @groupsToAdd = WebGUI::FormProcessor::group("groupsToAdd"); diff --git a/lib/WebGUI/ProfileField.pm b/lib/WebGUI/ProfileField.pm index e95d4af84..776c1603a 100644 --- a/lib/WebGUI/ProfileField.pm +++ b/lib/WebGUI/ProfileField.pm @@ -124,7 +124,7 @@ sub formField { my $self = shift; my $properties = shift || {}; my $withWrapper = shift; - $properties->{label} = $self->getLabel; + $properties->{label} = $self->getLabel unless $properties->{label}; $properties->{fieldType} = $self->get("fieldType"); $properties->{name} = $self->getId; my $values = WebGUI::Operation::Shared::secureEval($self->get("possibleValues")) || {};