Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/lib/ObjectModel/CGI/FormPage.pm | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/testbot/lib/ObjectModel/CGI/FormPage.pm b/testbot/lib/ObjectModel/CGI/FormPage.pm index 6f3449b5b2..f2fd0f09cd 100644 --- a/testbot/lib/ObjectModel/CGI/FormPage.pm +++ b/testbot/lib/ObjectModel/CGI/FormPage.pm @@ -503,14 +503,17 @@ sub GenerateBody($) $self->GenerateFields(); $self->GenerateRequiredLegend();
- if (defined $self->{ErrMessage}) + my $ErrMessage = $self->GetErrMessage(); + if (defined $ErrMessage) { - if (defined $self->{ErrField}) + my $ErrField = $self->GetErrField(); + if (defined $ErrField) { - my $PropertyDescriptor = $self->GetPropertyDescriptorByName($self->{ErrField}); + my $PropertyDescriptor = $self->GetPropertyDescriptorByName($ErrField); if ($PropertyDescriptor and !($self->DisplayProperty($PropertyDescriptor))[0]) { - $self->{ErrMessage} = "Internal error?\n$self->{ErrMessage}"; + # The hidden fields should not be invalid + $self->AddError("Internal error?\n$ErrMessage", $ErrField); } } $self->GenerateErrorPopup(); @@ -573,8 +576,7 @@ sub Validate($) my $ErrMessage = $PropertyDescriptor->ValidateValue($Value, 1); if ($ErrMessage) { - $self->{ErrMessage} = $ErrMessage; - $self->{ErrField} = $PropertyDescriptor->GetName(); + $self->AddError($ErrMessage, $PropertyDescriptor->GetName()); return !1; } } @@ -686,7 +688,7 @@ sub OnAction($$) { my ($self, $Action) = @_;
- $self->SetError(undef, "No action defined for $Action"); + $self->AddError("No action defined for $Action"); return 0; }