Fix handling of multi-form and multiple select form elements by emitting

a hidden form variable to make sure the form element was in the generated form.
Changes in User and ProfileField to support this.
This commit is contained in:
Colin Kuskie 2009-01-26 21:03:23 +00:00
parent 83d1203de9
commit 41da738e0e
9 changed files with 134 additions and 17 deletions

View file

@ -120,7 +120,7 @@ sub create {
# Get the field's data type
$properties->{fieldType} ||= "ReadOnly";
my $formClass = 'WebGUI::Form::' . ucfirst $properties->{fieldType};
my $formClass = $self->getFormControlClass;
eval "use $formClass;";
my $dbDataType = $formClass->getDatabaseFieldType;
@ -545,6 +545,25 @@ sub isEditable {
}
#-------------------------------------------------------------------
=head2 isInRequest ( )
Returns a boolean indicating whether this field was in the posted data.
=cut
sub isInRequest {
my $self = shift;
my $session = $self->session;
my $form = WebGUI::Form::DynamicField->new($session,
fieldType => $self->get('fieldType'),
name => $self->getId,
);
return $form->isInRequest;
}
#-------------------------------------------------------------------
=head2 isProtected ( )
@ -812,7 +831,7 @@ sub set {
# If the fieldType has changed, modify the userProfileData column
if ($properties->{fieldType} ne $self->get("fieldType")) {
# Create a copy of the new properties so we don't mess them up
my $fieldClass = "WebGUI::Form::".ucfirst($properties->{fieldType});
my $fieldClass = $self->getFormControlClass;
eval "use $fieldClass;";
my $dbDataType
= $fieldClass->new($session, $self->formProperties($properties))->getDatabaseFieldType;