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

@ -18,6 +18,7 @@ use strict;
use base 'WebGUI::Form::List';
use WebGUI::Form::Checkbox;
use WebGUI::Form::Button;
use WebGUI::Form::Hidden;
use WebGUI::International;
=head1 NAME
@ -129,6 +130,18 @@ sub isDynamicCompatible {
#-------------------------------------------------------------------
=head2 isInRequest ( )
=cut
sub isInRequest {
my $self = shift;
my $form = $self->session->form;
return $form->hasParam($self->privateName('isIn'));
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders a series of checkboxes.
@ -136,8 +149,10 @@ Renders a series of checkboxes.
=cut
sub toHtml {
my $self = shift;
my $self = shift;
my $session = $self->session;
my $output = '<fieldset style="border:none;margin:0;padding:0">';
$output .= WebGUI::Form::Hidden($session, { name => $self->privateName('isIn'), value => 1, });
my $alignment = $self->alignmentSeparator;
# Add the select all button
@ -153,7 +168,7 @@ sub toHtml {
? 1
: 0
;
$output .= WebGUI::Form::Checkbox->new($self->session, {
$output .= WebGUI::Form::Checkbox->new($session, {
name => $self->get('name'),
value => $key,
extras => $self->get('extras'),