'
@@ -160,12 +101,26 @@ sub getFilePreview {
$preview .= '
';
+ $preview .= $i18n->get(392) . " "x4 . WebGUI::Form::YesNo->new($self->session, {-name=>$self->privateName('delete'), -value=>0})->toHtml;
}
return $preview;
}
#-------------------------------------------------------------------
+=head2 getName ( session )
+
+Returns the human readable name of this control.
+
+=cut
+
+sub getName {
+ my ($self, $session) = @_;
+ return WebGUI::International->new($session, 'WebGUI')->get('image');
+}
+
+#-------------------------------------------------------------------
+
=head2 getStorageLocation ( )
Returns the WebGUI::Storage object for this control.
@@ -174,22 +129,23 @@ Returns the WebGUI::Storage object for this control.
sub getStorageLocation {
my $self = shift;
- my $storage = WebGUI::Storage::Image->get($self->session, $self->get("value")) if ($self->get("value"));
+ my $value = $self->getDefaultValue;
+ my $storage = WebGUI::Storage::Image->get($self->session, $value) if ($value);
return $storage;
}
#-------------------------------------------------------------------
-=head2 getValueFromPost ( )
+=head2 getValue ( )
-See WebGUI::Form::File::getValueFromPost() for details. Generates a thumbnail.
+See WebGUI::Form::File::getValue() for details. Generates a thumbnail.
=cut
-sub getValueFromPost {
+sub getValue {
my $self = shift;
- my $id = $self->SUPER::getValueFromPost(@_);
+ my $id = $self->SUPER::getValue(@_);
if (defined $id) {
my $storage = WebGUI::Storage::Image->get($self->session, $id);
if (defined $storage) {
@@ -207,5 +163,35 @@ sub getValueFromPost {
return $id;
}
+#-------------------------------------------------------------------
+
+=head2 getValueAsHtml ( )
+
+Displays the image using an img tag.
+
+=cut
+
+sub getValueAsHtml {
+ my ($self) = @_;
+ my $value = $self->getValue;
+ return '' unless $value;
+ my $location = WebGUI::Storage::Image->get($self->session, $value);
+ my $file = shift @{ $location->getFiles };
+ my $fileValue = sprintf qq| %s|, $location->getUrl($file), $file;
+ return $fileValue;
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 isDynamicCompatible ( )
+
+A class method that returns a boolean indicating whether this control is compatible with the DynamicField control.
+
+=cut
+
+sub isDynamicCompatible {
+ return 1;
+}
1;
diff --git a/lib/WebGUI/Form/IntSlider.pm b/lib/WebGUI/Form/IntSlider.pm
index c1da8ca37..47d1d8a95 100644
--- a/lib/WebGUI/Form/IntSlider.pm
+++ b/lib/WebGUI/Form/IntSlider.pm
@@ -50,36 +50,34 @@ The following additional parameters have been added via this sub class.
The length of the input box.
-=head4 profileEnabled
-
-Flag that tells the User Profile system that this is a valid form element in a User Profile
-
=cut
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
- my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
- formName=>{
- defaultValue=> $i18n->get("int slider")
- },
size=>{
defaultValue=> "3",
},
- profileEnabled=>{
- defaultValue=>1
- },
- dbDataType => {
- defaultValue => "BIGINT",
- },
});
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
+=head2 getDatabaseFieldType ( )
+
+Returns "BIGINT".
+
+=cut
+
+sub getDatabaseFieldType {
+ return "BIGINT";
+}
+
+#-------------------------------------------------------------------
+
=head2 getInputElement ( )
Returns the form element used for manual input.
@@ -99,6 +97,19 @@ sub getInputElement {
#-------------------------------------------------------------------
+=head2 getName ( session )
+
+Returns the human readable name of this control.
+
+=cut
+
+sub getName {
+ my ($self, $session) = @_;
+ return WebGUI::International->new($session, 'WebGUI')->get('int slider');
+}
+
+#-------------------------------------------------------------------
+
=head2 getOnChangeInputElement ( )
Returns the javascript code to update the slider and other form elements on a
@@ -130,7 +141,7 @@ sub getOnChangeSlider {
#-------------------------------------------------------------------
-=head2 getValueFromPost ( [ value ] )
+=head2 getValue ( [ value ] )
Retrieves a value from a form GET or POST and returns it. If the value comes back as undef, this method will return the defaultValue instead. Strip newlines/carriage returns from the value.
@@ -140,7 +151,7 @@ A value to process instead of POST input.
=cut
-sub getValueFromPost {
+sub getValue {
my $self = shift;
my @args = @_;
@@ -151,7 +162,19 @@ sub getValueFromPost {
id => 'view-'.$self->get('id'),
};
- return WebGUI::Form::Integer->new($self->session, $properties)->getValueFromPost(@args);
+ return WebGUI::Form::Integer->new($self->session, $properties)->getValue(@args);
+}
+
+#-------------------------------------------------------------------
+
+=head2 isDynamicCompatible ( )
+
+A class method that returns a boolean indicating whether this control is compatible with the DynamicField control.
+
+=cut
+
+sub isDynamicCompatible {
+ return 1;
}
1;
diff --git a/lib/WebGUI/Form/Integer.pm b/lib/WebGUI/Form/Integer.pm
index b5b01ba22..6cca40746 100644
--- a/lib/WebGUI/Form/Integer.pm
+++ b/lib/WebGUI/Form/Integer.pm
@@ -58,21 +58,13 @@ Defaults to 0. Used if no value is specified.
Defaults to 11. The number of characters that will be displayed at once in this field. Usually no need to override the default.
-=head4 profileEnabled
-
-Flag that tells the User Profile system that this is a valid form element in a User Profile
-
=cut
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
- my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
- formName=>{
- defaultValue=>$i18n->get("482")
- },
maxlength=>{
defaultValue=> 11
},
@@ -82,19 +74,38 @@ sub definition {
size=>{
defaultValue=>11
},
- profileEnabled=>{
- defaultValue=>1
- },
- dbDataType => {
- defaultValue => "BIGINT",
- },
});
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
-=head2 getValueFromPost ( [ value ] )
+=head2 getDatabaseFieldType ( )
+
+Returns "BIGINT".
+
+=cut
+
+sub getDatabaseFieldType {
+ return "BIGINT";
+}
+
+#-------------------------------------------------------------------
+
+=head2 getName ( session )
+
+Returns the human readable name of this control.
+
+=cut
+
+sub getName {
+ my ($self, $session) = @_;
+ return WebGUI::International->new($session, 'WebGUI')->get('482');
+}
+
+#-------------------------------------------------------------------
+
+=head2 getValue ( [ value ] )
Returns the integer from the form post, or returns 0 if the post result is invalid.
@@ -104,9 +115,9 @@ An optional value to process, instead of POST input.
=cut
-sub getValueFromPost {
+sub getValue {
my $self = shift;
- my $value = @_ ? shift : $self->session->form->param($self->get("name"));
+ my $value = $self->SUPER::getValue(@_);
if ($value =~ /^-?\d+$/) {
return $value;
}
@@ -115,6 +126,18 @@ sub getValueFromPost {
#-------------------------------------------------------------------
+=head2 isDynamicCompatible ( )
+
+A class method that returns a boolean indicating whether this control is compatible with the DynamicField control.
+
+=cut
+
+sub isDynamicCompatible {
+ return 1;
+}
+
+#-------------------------------------------------------------------
+
=head2 toHtml ( )
Renders an integer field.
diff --git a/lib/WebGUI/Form/Interval.pm b/lib/WebGUI/Form/Interval.pm
index e453863fd..f7f693a61 100644
--- a/lib/WebGUI/Form/Interval.pm
+++ b/lib/WebGUI/Form/Interval.pm
@@ -55,37 +55,48 @@ The following additional parameters have been added via this sub class.
A time interval in seconds that is used if value is not specified. Defaults to 1.
-=head4 profileEnabled
-
-Flag that tells the User Profile system that this is a valid form element in a User Profile
-
=cut
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
- my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
- formName=>{
- defaultValue=>$i18n->get("interval"),
- },
defaultValue=>{
defaultValue=>1,
},
- profileEnabled=>{
- defaultValue=>1
- },
- dbDataType => {
- defaultValue => "BIGINT",
- },
});
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
-=head2 getValueFromPost ( [ num_and_units ] )
+=head2 getDatabaseFieldType ( )
+
+Returns "BIGINT".
+
+=cut
+
+sub getDatabaseFieldType {
+ return "BIGINT";
+}
+
+#-------------------------------------------------------------------
+
+=head2 getName ( session )
+
+Returns the human readable name of this control.
+
+=cut
+
+sub getName {
+ my ($self, $session) = @_;
+ return WebGUI::International->new($session, 'WebGUI')->get('interval');
+}
+
+#-------------------------------------------------------------------
+
+=head2 getValue ( [ num_and_units ] )
Returns either the interval that was posted (in seconds) or if nothing comes back it returns 0.
@@ -95,7 +106,7 @@ The number and units for this interval, to use instead of POST input, which is t
=cut
-sub getValueFromPost {
+sub getValue {
my $self = shift;
if (@_) {
@@ -108,6 +119,18 @@ sub getValueFromPost {
#-------------------------------------------------------------------
+=head2 isDynamicCompatible ( )
+
+A class method that returns a boolean indicating whether this control is compatible with the DynamicField control.
+
+=cut
+
+sub isDynamicCompatible {
+ return 1;
+}
+
+#-------------------------------------------------------------------
+
=head2 toHtml ( )
Renders an interval control.
@@ -126,7 +149,7 @@ sub toHtml {
'weeks'=>$i18n->get(701),
'months'=>$i18n->get(702),
'years'=>$i18n->get(703));
- my ($interval, $units) = $self->session->datetime->secondsToInterval($self->get("value"));
+ my ($interval, $units) = $self->session->datetime->secondsToInterval($self->getDefaultValue);
# not sure why, but these things need to be defined like this or
# they fail under some circumstnaces
my $cmd = "WebGUI::Form::Integer";
@@ -141,7 +164,7 @@ sub toHtml {
options=>\%units,
name=>$self->get("name")."_units",
id=>$self->get('id')."_units",
- value=>[$units]
+ value=>$units
)->toHtml;
return $out;
}
@@ -157,7 +180,7 @@ Returns the field as hidden controls rather than displayable controls.
sub toHtmlAsHidden {
my $self = shift;
- my ($interval, $units) = $self->session->datetime->secondsToInterval($self->get("value"));
+ my ($interval, $units) = $self->session->datetime->secondsToInterval($self->getDefaultValue);
return WebGUI::Form::Hidden->new($self->session,
name=>$self->get("name").'_interval',
value=>$interval
diff --git a/lib/WebGUI/Form/LdapLink.pm b/lib/WebGUI/Form/LdapLink.pm
index f444a13cb..87ae2e913 100644
--- a/lib/WebGUI/Form/LdapLink.pm
+++ b/lib/WebGUI/Form/LdapLink.pm
@@ -39,6 +39,18 @@ The following methods are specifically available from this class. Check the supe
#-------------------------------------------------------------------
+=head2 areOptionsSettable ( )
+
+Returns 0.
+
+=cut
+
+sub areOptionsSettable {
+ return 0;
+}
+
+#-------------------------------------------------------------------
+
=head2 definition ( [ additionalTerms ] )
See the super class for additional details.
@@ -79,9 +91,6 @@ sub definition {
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
- formName=>{
- defaultValue=>$i18n->get("LDAPLink_1075","AuthLDAP")
- },
label=>{
defaultValue=>$i18n->get("LDAPLink_1075","AuthLDAP")
},
@@ -100,15 +109,49 @@ sub definition {
afterEdit=>{
defaultValue=>undef
},
- dbDataType => {
- defaultValue => "TEXT",
- },
- });
+ });
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
+=head2 getDatabaseFieldType ( )
+
+Returns "TEXT".
+
+=cut
+
+sub getDatabaseFieldType {
+ return "TEXT";
+}
+
+#-------------------------------------------------------------------
+
+=head2 getName ( session )
+
+Returns the human readable name of this control.
+
+=cut
+
+sub getName {
+ my ($self, $session) = @_;
+ return WebGUI::International->new($session, 'AuthLDAP')->get('LDAPLink_1075');
+}
+
+#-------------------------------------------------------------------
+
+=head2 isDynamicCompatible ( )
+
+Returns 0.
+
+=cut
+
+sub isDynamicCompatible {
+ return 0;
+}
+
+#-------------------------------------------------------------------
+
=head2 toHtml ( )
Renders a database connection picker control.
@@ -148,7 +191,7 @@ sub toHtmlWithWrapper {
if ($self->session->user->isInGroup(3)) {
my $subtext;
if ($self->get("afterEdit")) {
- $subtext = $self->session->icon->edit("op=editLDAPLink;llid=".$self->get("value").";afterEdit=".$self->session->url->escape($self->get("afterEdit")));
+ $subtext = $self->session->icon->edit("op=editLDAPLink;llid=".$self->getDefaultValue.";afterEdit=".$self->session->url->escape($self->get("afterEdit")));
}
$subtext .= $self->session->icon->manage("op=listLDAPLinks");
$self->set("subtext", $subtext . $self->get("subtext"));
diff --git a/lib/WebGUI/Form/List.pm b/lib/WebGUI/Form/List.pm
index 923506057..9199f202b 100644
--- a/lib/WebGUI/Form/List.pm
+++ b/lib/WebGUI/Form/List.pm
@@ -58,56 +58,16 @@ sub alignmentSeparator {
#-------------------------------------------------------------------
-=head2 correctOptions ( )
+=head2 areOptionsSettable ( )
-Parse a string for a list of options to present to the user. This method
-will mainly be called from WebGUI::Form::DynamicField.
+Returns a boolean indicating whether the options of the list are settable. Some have a predefined set of options. This is useful in generating dynamic forms. Returns 1.
=cut
-sub correctOptions {
- my ($self, $possibleValues) = @_;
- my %options;
- tie %options, 'Tie::IxHash';
- foreach (split(/\n/, $possibleValues)) {
- s/\s+$//; # remove trailing spaces
- $options{$_} = $_;
- }
- if ($self->get('options') && ref($self->get('options')) eq "HASH") {
- %options = (%{$self->get('options')} , %options);
- }
- $self->set('options', \%options);
+sub areOptionsSettable {
+ return 1;
}
-
-##-------------------------------------------------------------------
-
-=head2 correctValues ( )
-
-Parse a string for a list of values that should be selected. This method
-will mainly be called from WebGUI::Form::DynamicField. Form types that
-don't have multiple select, like RadioLists, need to override this
-method.
-
-=cut
-
-sub correctValues {
- my ($self, $value) = @_;
- return undef unless defined $value;
- my @defaultValues;
- if (ref $value eq "ARRAY") {
- @defaultValues = @{ $value };
- }
- else {
- foreach (split(/\n/, $value)) {
- s/\s+$//; # remove trailing spaces
- push(@defaultValues, $_);
- }
- }
- $self->set("value", \@defaultValues);
-}
-
-
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
@@ -138,25 +98,17 @@ A boolean indicating whether the user can select multiple items from this list l
A boolean value for whether or not the values in the options hash should be sorted. Defaults to "0".
-=head4 profileEnabled
-
-Flag that tells the User Profile system that this is a valid form element in a User Profile
-
=cut
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
- my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
- formName=>{
- defaultValue=>$i18n->get("486"),
- },
options=>{
defaultValue=>{}
},
- defaultValue=>{
+ defaultValue=>{
defaultValue=>[],
},
multiple=>{
@@ -168,12 +120,6 @@ sub definition {
size=>{
defaultValue=>1
},
- profileEnabled=>{
- defaultValue=>0
- },
- dbDataType => {
- defaultValue => "TEXT",
- },
});
return $class->SUPER::definition($session, $definition);
}
@@ -181,22 +127,72 @@ sub definition {
#-------------------------------------------------------------------
-=head2 displayValue ( )
+=head2 getDatabaseFieldType ( )
-Return all the options
+Returns "LONGTEXT".
-=cut
+=cut
-sub displayValue {
- my ($self) = @_;
- return join ", ", $self->getValues();
+sub getDatabaseFieldType {
+ return "LONGTEXT";
}
#-------------------------------------------------------------------
-=head2 getValueFromPost ( [ value ] )
+=head2 getName ( session )
-Returns an array or a carriage return ("\n") separated scalar depending upon whether you're returning the values into an array or a scalar.
+Returns the human readable name of this control.
+
+=cut
+
+sub getName {
+ my ($self, $session) = @_;
+ return WebGUI::International->new($session, 'WebGUI')->get('486');
+}
+
+#-------------------------------------------------------------------
+
+=head2 getOptions ( )
+
+Options are passed in for many list types. Those options can come in as a hash ref, or a \n separated string, or a key|value\n separated string. This method returns a hash ref regardless of what's passed in.
+
+=cut
+
+sub getOptions {
+ my ($self) = @_;
+ my $possibleValues = $self->get('options');
+ my %options = ();
+ tie %options, 'Tie::IxHash';
+ if (ref $possibleValues eq "HASH") {
+ %options = %{$possibleValues};
+ }
+ else {
+ foreach my $line (split "\n", $possibleValues) {
+ if ($line =~ m/(.*)|(.*)/) {
+ $options{$1} = $2;
+ }
+ else {
+ $options{$line} = $line;
+ }
+ }
+ }
+ if ($self->get('sortByValue')) {
+ my %ordered = ();
+ tie %ordered, 'Tie::IxHash';
+ foreach my $optionKey (sort {"\L$options{$a}" cmp "\L$options{$b}" } keys %options) {
+ $ordered{$optionKey} = $options{$optionKey};
+ }
+ return \%ordered;
+ }
+ return \%options;
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 getValue ( [ value ] )
+
+Returns an array or a carriage return ("\n") separated scalar depending upon whether you're returning the values into an array or a scalar. Also parses the input values (wherever they come from) to see if it's a scalar then it splits on \n.
=head3 value
@@ -204,56 +200,78 @@ Optional values to process, instead of POST input.
=cut
-sub getValueFromPost {
- my $self = shift;
- my @data = @_ ? @_ : $self->session->form->param($self->get("name"));
- return wantarray ? @data : join("\n",@data);
+sub getValue {
+ my ($self, $value) = @_;
+ my @values = ();
+ if (defined $value) {
+ if (ref $value eq "ARRAY") {
+ @values = @{$value};
+ }
+ else {
+ @values = split "\n", $value;
+ }
+ }
+ if (scalar @values < 1 && $self->session->request) {
+ my $value = $self->session->form->param($self->get("name"));
+ if (defined $value) {
+ @values = $self->session->form->param($self->get("name"));
+ }
+ }
+ if (scalar @values < 1) {
+ @values = $self->getDefaultValue;
+ }
+ return wantarray ? @values : join("\n",@values);
+}
+
+#-------------------------------------------------------------------
+
+=head2 getDefaultValue ( )
+
+Returns the either the "value" ore "defaultValue" passed in to the object in that order, and doesn't take into account form processing.
+
+=cut
+
+sub getDefaultValue {
+ my $self = shift;
+ my @values = ();
+ foreach my $value ($self->get("value"), $self->get("defaultValue")) {
+ if (scalar @values < 1 && defined $value) {
+ if (ref $value eq "ARRAY") {
+ @values = @{$value};
+ }
+ else {
+ @values = split "\n", $value;
+ }
+ }
+ }
+ return wantarray ? @values : join("\n",@values);
+}
+
+#-------------------------------------------------------------------
+
+=head2 getValueAsHtml ( )
+
+Return all the options
+
+=cut
+
+sub getValueAsHtml {
+ my ($self) = @_;
+ my $options = $self->getOptions;
+ return join ", ", map { $options->{$_} } $self->getValue();
}
#-------------------------------------------------------------------
=head2 getValues ( )
-Safely handle returning values whether the stored data is scalar or an array
-ref.
+Depricated. See getValue().
=cut
sub getValues {
my $self = shift;
- my @values = ();
- if (ref $self->get("value") eq 'ARRAY') {
- @values = @{ $self->get("value") };
- }
- else {
- push @values, $self->get("value");
- }
- return @values;
-}
-
-#-------------------------------------------------------------------
-
-=head2 orderedHash ( )
-
-Based on whether the sortByValue flag is set, return the options hash
-for List type Forms sorted by values. The sort is done without regard
-to the case of the values.
-
-=cut
-
-sub orderedHash {
- my ($self) = @_;
- my %options;
- tie %options, 'Tie::IxHash';
- my $original = $self->get("options");
- if ($self->get('sortByValue')) {
- foreach my $optionKey (sort {"\L$original->{$a}" cmp "\L$original->{$b}" } keys %{$original}) {
- $options{$optionKey} = $original->{$optionKey};
- }
- } else {
- %options = %{$original};
- }
- return %options;
+ return $self->getValue(@_);
}
@@ -267,21 +285,19 @@ Creates a series of hidden fields representing the data in the list.
sub toHtmlAsHidden {
my $self = shift;
- my %options;
- tie %options, 'Tie::IxHash';
- %options = $self->orderedHash();
+ my $options = $self->getOptions();
my $output;
- my @values = $self->getValues();
- foreach my $key (keys %options) {
- foreach my $item (@values) {
- if ($item eq $key) {
- $output .= WebGUI::Form::Hidden->new($self->session,
- name=>$self->get("name"),
- value=>$key
- )->toHtmlAsHidden;
- }
- }
- }
+ my @values = $self->getDefaultValue();
+ foreach my $key (keys %{$options}) {
+ foreach my $item (@values) {
+ if ($item eq $key) {
+ $output .= WebGUI::Form::Hidden->new($self->session,
+ name=>$self->get("name"),
+ value=>$key
+ )->toHtmlAsHidden;
+ }
+ }
+ }
return $output;
}
diff --git a/lib/WebGUI/Form/MimeType.pm b/lib/WebGUI/Form/MimeType.pm
index 000a832be..0c972197c 100644
--- a/lib/WebGUI/Form/MimeType.pm
+++ b/lib/WebGUI/Form/MimeType.pm
@@ -58,21 +58,40 @@ sub definition {
my $definition = shift || [];
my $i18n = WebGUI::International->new($session, 'Form_MimeType');
push(@{$definition}, {
- formName=>{
- defaultValue=>$i18n->get('mimeType'),
- },
label=>{
defaultValue=>$i18n->get('mimeType'),
},
- profileEnabled=>{
- defaultValue=>0
- }
});
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
+=head2 getName ( session )
+
+Returns the human readable name of this control.
+
+=cut
+
+sub getName {
+ my ($self, $session) = @_;
+ return WebGUI::International->new($session, 'Form_MimeType')->get('mimeType');
+}
+
+#-------------------------------------------------------------------
+
+=head2 isDynamicCompatible ( )
+
+Returns 0.
+
+=cut
+
+sub isDynamicCompatible {
+ return 0;
+}
+
+#-------------------------------------------------------------------
+
=head2 toHtml ( )
Renders a database connection picker control.
diff --git a/lib/WebGUI/Form/Password.pm b/lib/WebGUI/Form/Password.pm
index 6a1179690..b291e1f07 100644
--- a/lib/WebGUI/Form/Password.pm
+++ b/lib/WebGUI/Form/Password.pm
@@ -54,36 +54,63 @@ Defaults to 35. Determines the maximum number of characters allowed in this fiel
Defaults to 30. Specifies how big of a text box to display.
-=head4 profileEnabled
-
-Flag that tells the User Profile system that this is a valid form element in a User Profile
-
=cut
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
- my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
- formName=>{
- defaultValue=>$i18n->get("51")
- },
maxlength=>{
defaultValue=>35
},
size=>{
defaultValue=>30
},
- profileEnabled=>{
- defaultValue=>1
- },
});
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
+=head2 getName ( session )
+
+Returns the human readable name of this control.
+
+=cut
+
+sub getName {
+ my ($self, $session) = @_;
+ return WebGUI::International->new($session, 'WebGUI')->get('51');
+}
+
+#-------------------------------------------------------------------
+
+=head2 getValueAsHtml ( )
+
+Formats as ******.
+
+=cut
+
+sub getValueAsHtml {
+ return '******';
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 isDynamicCompatible ( )
+
+A class method that returns a boolean indicating whether this control is compatible with the DynamicField control.
+
+=cut
+
+sub isDynamicCompatible {
+ return 1;
+}
+
+#-------------------------------------------------------------------
+
=head2 toHtml ( )
Renders an input tag of type password.
@@ -92,7 +119,7 @@ Renders an input tag of type password.
sub toHtml {
my $self = shift;
- my $html = 'get("maxlength").'" ' if ($self->get("maxlength"));
$html .= $self->get("extras").' />';
return $html;
diff --git a/lib/WebGUI/Form/Phone.pm b/lib/WebGUI/Form/Phone.pm
index 09657fa51..e96c3943f 100644
--- a/lib/WebGUI/Form/Phone.pm
+++ b/lib/WebGUI/Form/Phone.pm
@@ -38,39 +38,20 @@ The following methods are specifically available from this class. Check the supe
#-------------------------------------------------------------------
-=head2 definition ( [ additionalTerms ] )
+=head2 getName ( session )
-See the super class for additional details.
-
-=head3 additionalTerms
-
-The following additional parameters have been added via this sub class.
-
-=head4 profileEnabled
-
-Flag that tells the User Profile system that this is a valid form element in a User Profile
+Returns the human readable name of this control.
=cut
-sub definition {
- my $class = shift;
- my $session = shift;
- my $definition = shift || [];
- my $i18n = WebGUI::International->new($session);
- push(@{$definition}, {
- formName=>{
- defaultValue=>$i18n->get("481")
- },
- profileEnabled=>{
- defaultValue=>1
- },
- });
- return $class->SUPER::definition($session, $definition);
+sub getName {
+ my ($self, $session) = @_;
+ return WebGUI::International->new($session, 'WebGUI')->get('481');
}
#-------------------------------------------------------------------
-=head2 getValueFromPost ( [ value ] )
+=head2 getValue ( [ value ] )
Returns a string filtered to allow only digits, spaces, and these special characters: + - ( ) or it will return undef it the number doesn't validate to those.
@@ -80,9 +61,9 @@ An input value to use instead of POST input.
=cut
-sub getValueFromPost {
+sub getValue {
my $self = shift;
- my $value = @_ ? shift : $self->session->form->param($self->get("name"));
+ my $value = $self->SUPER::getValue(@_);
if ($value =~ /^[x\d \.\-\+\(\)]+$/ and $value =~ /\d/) {
return $value;
}
@@ -91,6 +72,18 @@ sub getValueFromPost {
#-------------------------------------------------------------------
+=head2 isDynamicCompatible ( )
+
+A class method that returns a boolean indicating whether this control is compatible with the DynamicField control.
+
+=cut
+
+sub isDynamicCompatible {
+ return 1;
+}
+
+#-------------------------------------------------------------------
+
=head2 toHtml ( )
Renders a phone number field.
diff --git a/lib/WebGUI/Form/Radio.pm b/lib/WebGUI/Form/Radio.pm
index fbc52093c..4064c79e2 100644
--- a/lib/WebGUI/Form/Radio.pm
+++ b/lib/WebGUI/Form/Radio.pm
@@ -50,27 +50,16 @@ The following additional parameters have been added via this sub class.
Defaults to "0". Set to "1" if this field should be checked.
-=head4 profileEnabled
-
-Flag that tells the User Profile system that this is a valid form element in a User Profile
-
=cut
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
- my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
- formName=>{
- defaultValue=>$i18n->get("radio")
- },
checked=>{
defaultValue=> 0
},
- profileEnabled=>{
- defaultValue=>1
- },
});
return $class->SUPER::definition($session, $definition);
}
@@ -90,6 +79,19 @@ sub generateIdParameter {
#-------------------------------------------------------------------
+=head2 getName ( session )
+
+Returns the human readable name of this control.
+
+=cut
+
+sub getName {
+ my ($self, $session) = @_;
+ return WebGUI::International->new($session, 'WebGUI')->get('radio');
+}
+
+#-------------------------------------------------------------------
+
=head2 toHtml ( )
Renders and input tag of type radio.
diff --git a/lib/WebGUI/Form/RadioList.pm b/lib/WebGUI/Form/RadioList.pm
index 14c17dc6c..5789a5bad 100644
--- a/lib/WebGUI/Form/RadioList.pm
+++ b/lib/WebGUI/Form/RadioList.pm
@@ -37,17 +37,6 @@ The following methods are specifically available from this class. Check the supe
=cut
-##-------------------------------------------------------------------
-
-=head2 correctValues ( )
-
-Override method from master class since RadioList only supports a single value
-
-=cut
-
-sub correctValues { }
-
-
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
@@ -62,27 +51,16 @@ The following additional parameters have been added via this sub class.
Boolean representing whether the checklist should be represented vertically or horizontally. If set to "1" will be displayed vertically. Defaults to "0".
-=head4 profileEnabled
-
-Flag that tells the User Profile system that this is a valid form element in a User Profile
-
=cut
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
- my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
- formName=>{
- defaultValue=>$i18n->get("942")
- },
vertical=>{
defaultValue=>0
},
- profileEnabled=>{
- defaultValue=>1
- },
defaultValue=>{
defaultValue=>''
}
@@ -91,6 +69,57 @@ sub definition {
}
+#-------------------------------------------------------------------
+
+=head2 getName ( session )
+
+Returns the human readable name of this control.
+
+=cut
+
+sub getName {
+ my ($self, $session) = @_;
+ return WebGUI::International->new($session, 'WebGUI')->get('942');
+}
+
+#-------------------------------------------------------------------
+
+=head2 getValue ( [ value ] )
+
+See WebGUI::Form::Control::getValue()
+
+=cut
+
+sub getValue {
+ my $self = shift;
+ return $self->WebGUI::Form::Control::getValue(@_);
+}
+
+#-------------------------------------------------------------------
+
+=head2 getDefaultValue ( [ value ] )
+
+See WebGUI::Form::Control::getDefaultValue()
+
+=cut
+
+sub getDefaultValue {
+ my $self = shift;
+ return $self->WebGUI::Form::Control::getDefaultValue(@_);
+}
+
+#-------------------------------------------------------------------
+
+=head2 isDynamicCompatible ( )
+
+A class method that returns a boolean indicating whether this control is compatible with the DynamicField control.
+
+=cut
+
+sub isDynamicCompatible {
+ return 1;
+}
+
#-------------------------------------------------------------------
=head2 toHtml ( )
@@ -103,26 +132,24 @@ sub toHtml {
my $self = shift;
my $output;
my $alignment = $self->alignmentSeparator;
- my %options;
- tie %options, 'Tie::IxHash';
- %options = $self->orderedHash;
my $i=0;
- foreach my $key (keys %options) {
+ my $options = $self->getOptions;
+ foreach my $key (keys %{$options}) {
$i++;
- my $checked = 0;
- if ($self->get('value') eq $key) {
- $checked = 1;
- }
- $output .= WebGUI::Form::Radio->new($self->session, {
- name=>$self->get('name'),
- value=>$key,
- extras=>$self->get('extras'),
- checked=>$checked,
- id=>$self->get('name').$i
- })->toHtml;
- $output .= '" . $alignment;
+ my $checked = 0;
+ if ($self->get('value') eq $key) {
+ $checked = 1;
}
- return $output;
+ $output .= WebGUI::Form::Radio->new($self->session, {
+ name=>$self->get('name'),
+ value=>$key,
+ extras=>$self->get('extras'),
+ checked=>$checked,
+ id=>$self->get('name').$i
+ })->toHtml;
+ $output .= '" . $alignment;
+ }
+ return $output;
}
1;
diff --git a/lib/WebGUI/Form/ReadOnly.pm b/lib/WebGUI/Form/ReadOnly.pm
index bedc5b94e..3367b5e64 100644
--- a/lib/WebGUI/Form/ReadOnly.pm
+++ b/lib/WebGUI/Form/ReadOnly.pm
@@ -39,50 +39,43 @@ The following methods are specifically available from this class. Check the supe
#-------------------------------------------------------------------
-=head2 definition ( [ additionalTerms ] )
+=head2 getName ( session )
-See the super class for additional details.
-
-=head3 additionalTerms
-
-The following additional parameters have been added via this sub class.
-
-=head4 profileEnabled
-
-Flag that tells the User Profile system that this is a valid form element in a User Profile
+Returns the human readable name of this control.
=cut
-sub definition {
- my $class = shift;
- my $session = shift;
- my $definition = shift || [];
- my $i18n = WebGUI::International->new($session);
- push(@{$definition}, {
- formName=>{
- defaultValue=>$i18n->get("read only")
- },
- profileEnabled=>{
- defaultValue=>1
- },
- });
- return $class->SUPER::definition($session, $definition);
+sub getName {
+ my ($self, $session) = @_;
+ return WebGUI::International->new($session, 'WebGUI')->get('read only');
}
#-------------------------------------------------------------------
-=head2 getValueFromPost ( )
+=head2 getValue ( )
Returns undef.
=cut
-sub getValueFromPost {
+sub getValue {
return undef;
}
#-------------------------------------------------------------------
+=head2 isDynamicCompatible ( )
+
+A class method that returns a boolean indicating whether this control is compatible with the DynamicField control.
+
+=cut
+
+sub isDynamicCompatible {
+ return 1;
+}
+
+#-------------------------------------------------------------------
+
=head2 toHtml ( )
Renders the value.
@@ -91,7 +84,7 @@ Renders the value.
sub toHtml {
my $self = shift;
- return $self->get("value");
+ return $self->getDefaultValue;
}
#-------------------------------------------------------------------
diff --git a/lib/WebGUI/Form/SelectBox.pm b/lib/WebGUI/Form/SelectBox.pm
index ca8ac5ec8..6f039a5e9 100644
--- a/lib/WebGUI/Form/SelectBox.pm
+++ b/lib/WebGUI/Form/SelectBox.pm
@@ -36,16 +36,6 @@ The following methods are specifically available from this class. Check the supe
=cut
-##-------------------------------------------------------------------
-
-=head2 correctValues ( )
-
-Override method from master class since SelectBox only support a single value
-
-=cut
-
-sub correctValues { }
-
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
@@ -60,58 +50,92 @@ The following additional parameters have been added via this sub class.
The number of characters tall this list should be. Defaults to '1'.
-=head4 profileEnabled
-
-Flag that tells the User Profile system that this is a valid form element in a User Profile
-
=cut
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
- my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
- formName=>{
- defaultValue=>$i18n->get("487"),
- },
defaultValue=>{
defaultValue=>'', # gotta be a scalar, not an arrayref.
},
size=>{
defaultValue=>1,
},
- profileEnabled=>{
- defaultValue=>1,
- },
- dbDataType => {
- defaultValue => "VARCHAR(255)",
- }
});
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
-=head2 getValueFromPost ( [ value ] )
+=head2 getDatabaseFieldType ( )
-Retrieves a value from a form GET or POST and returns it. If the value comes back as undef, this method will return the defaultValue instead. Note, this is exactly the same method as used by Control since SelectBoxes only support a single value.
+Returns "VARCHAR(255)".
-=head3 value
+=cut
-Optional values to process (read "return"), instead of POST input.
+sub getDatabaseFieldType {
+ return "VARCHAR(255)";
+}
+
+#-------------------------------------------------------------------
+
+=head2 getName ( session )
+
+Returns the human readable name of this control.
=cut
-sub getValueFromPost {
- my $self = shift;
+sub getName {
+ my ($self, $session) = @_;
+ return WebGUI::International->new($session, 'WebGUI')->get('487');
+}
- my $formValue = @_ ? shift : $self->session->form->param($self->get("name"));
- if (defined $formValue) {
- return $formValue;
- } else {
- return $self->get("defaultValue");
+#-------------------------------------------------------------------
+
+=head2 getValue ( [ value ] )
+
+See WebGUI::Form::Control::getValue()
+
+=cut
+
+sub getValue {
+ my $self = shift;
+ return $self->WebGUI::Form::Control::getValue(@_);
+}
+
+#-------------------------------------------------------------------
+
+=head2 getDefaultValue ( )
+
+Returns the either the "value" ore "defaultValue" passed in to the object in that order, and doesn't take into account form processing.
+
+=cut
+
+sub getDefaultValue {
+ my $self = shift;
+ my $value = $self->get("value");
+ unless (defined $value) {
+ $value = $self->get("defaultValue");
}
+ if (ref $value eq 'ARRAY') {
+ $value = $value->[0];
+ }
+ return $value;
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 isDynamicCompatible ( )
+
+A class method that returns a boolean indicating whether this control is compatible with the DynamicField control.
+
+=cut
+
+sub isDynamicCompatible {
+ return 1;
}
#-------------------------------------------------------------------
@@ -125,17 +149,15 @@ Renders a select list form control.
sub toHtml {
my $self = shift;
my $output = ''."\n";
return $output;
}
diff --git a/lib/WebGUI/Form/SelectList.pm b/lib/WebGUI/Form/SelectList.pm
index af09464f0..1b23422b5 100644
--- a/lib/WebGUI/Form/SelectList.pm
+++ b/lib/WebGUI/Form/SelectList.pm
@@ -54,32 +54,18 @@ The number of characters tall this list should be. Defaults to '5'.
A boolean indicating whether the user can select multiple items from this list like a checkList. Defaults to "1".
-=head4 profileEnabled
-
-Flag that tells the User Profile system that this is a valid form element in a User Profile
-
=cut
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
- my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
- formName=>{
- defaultValue=>$i18n->get("484"),
- },
multiple=>{
defaultValue=>1
},
size=>{
defaultValue=>5
- },
- profileEnabled=>{
- defaultValue=>1
- },
- dbDataType => {
- defaultValue => "LONGTEXT",
},
});
return $class->SUPER::definition($session, $definition);
@@ -87,6 +73,31 @@ sub definition {
#-------------------------------------------------------------------
+=head2 getName ( session )
+
+Returns the human readable name of this control.
+
+=cut
+
+sub getName {
+ my ($self, $session) = @_;
+ return WebGUI::International->new($session, 'WebGUI')->get('484');
+}
+
+#-------------------------------------------------------------------
+
+=head2 isDynamicCompatible ( )
+
+A class method that returns a boolean indicating whether this control is compatible with the DynamicField control.
+
+=cut
+
+sub isDynamicCompatible {
+ return 1;
+}
+
+#-------------------------------------------------------------------
+
=head2 toHtml ( )
Renders a select list form control.
@@ -97,18 +108,16 @@ sub toHtml {
my $self = shift;
my $multiple = $self->get("multiple") ? ' multiple="multiple"' : '';
my $output = ''."\n";
return $output;
diff --git a/lib/WebGUI/Form/SelectRichEditor.pm b/lib/WebGUI/Form/SelectRichEditor.pm
index aa57f221f..bfd10c77f 100644
--- a/lib/WebGUI/Form/SelectRichEditor.pm
+++ b/lib/WebGUI/Form/SelectRichEditor.pm
@@ -36,6 +36,18 @@ The following methods are specifically available from this class. Check the supe
=cut
+#-------------------------------------------------------------------
+
+=head2 areOptionsSettable ( )
+
+Returns 0.
+
+=cut
+
+sub areOptionsSettable {
+ return 0;
+}
+
#----------------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
@@ -57,11 +69,7 @@ sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
- my $i18n = WebGUI::International->new($session);
push @{$definition}, {
- formName => {
- defaultValue => $i18n->get("475"),
- },
defaultValue => {
defaultValue => '',
},
@@ -69,6 +77,19 @@ sub definition {
return $class->SUPER::definition($session, $definition);
}
+#-------------------------------------------------------------------
+
+=head2 getName ( session )
+
+Returns the human readable name of this control.
+
+=cut
+
+sub getName {
+ my ($self, $session) = @_;
+ return WebGUI::International->new($session, 'WebGUI')->get('SelectRichEditor formName');
+}
+
#----------------------------------------------------------------------------
=head2 new
diff --git a/lib/WebGUI/Form/SelectSlider.pm b/lib/WebGUI/Form/SelectSlider.pm
index 40c13bbb2..d2dd142b1 100644
--- a/lib/WebGUI/Form/SelectSlider.pm
+++ b/lib/WebGUI/Form/SelectSlider.pm
@@ -41,29 +41,44 @@ sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
- my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
- formName=>{
- defaultValue=> $i18n->get("select slider")
- },
options =>{
defaultValue=>{},
},
value =>{
defaultValue=>[],
},
- profileEnabled=>{
- defaultValue=>1
- },
- dbDataType => {
- defaultValue => "TEXT",
- },
});
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
+=head2 getDatabaseFieldType ( )
+
+Returns "TEXT".
+
+=cut
+
+sub getDatabaseFieldType {
+ return "TEXT";
+}
+
+#-------------------------------------------------------------------
+
+=head2 getName ( session )
+
+Returns the human readable name of this control.
+
+=cut
+
+sub getName {
+ my ($self, $session) = @_;
+ return WebGUI::International->new($session, 'WebGUI')->get('select slider');
+}
+
+#-------------------------------------------------------------------
+
=head2 getDisplayValue ( )
Returns the value that should be displayed initially.
@@ -73,7 +88,7 @@ Returns the value that should be displayed initially.
sub getDisplayValue {
my $self = shift;
- return $self->get('options')->{$self->get('value')->[0]};
+ return $self->getOptions->{$self->get('value')->[0]};
}
#-------------------------------------------------------------------
@@ -90,7 +105,7 @@ sub getInputElement {
return WebGUI::Form::selectList($self->session, {
-name => $self->get('name'),
-value => $self->get('value'),
- -options=> $self->get('options'),
+ -options=> $self->getOptions,
-id => 'view-'.$self->get('id'),
-size => 1,
});
@@ -131,6 +146,35 @@ sub getOnChangeSlider {
#-------------------------------------------------------------------
+=head2 getOptions ( )
+
+Options are passed in for many list types. Those options can come in as a hash ref, or a \n separated string, or a key|value\n separated string. This method returns a hash ref regardless of what's passed in.
+
+=cut
+
+sub getOptions {
+ my ($self) = @_;
+ my $possibleValues = $self->get('options');
+ my %options = ();
+ tie %options, 'Tie::IxHash';
+ if (ref $possibleValues eq "HASH") {
+ %options = %{$possibleValues};
+ }
+ else {
+ foreach my $line (split "\n", $possibleValues) {
+ if ($line =~ m/(.*)|(.*)/) {
+ $options{$1} = $2;
+ }
+ else {
+ $options{$line} = $line;
+ }
+ }
+ }
+ return \%options;
+}
+
+#-------------------------------------------------------------------
+
=head2 getSliderMaximum ( )
Returns the maximum value the slider can be set to in slider units.
@@ -140,7 +184,7 @@ Returns the maximum value the slider can be set to in slider units.
sub getSliderMaximum {
my $self = shift;
- return scalar(keys %{$self->get('options')}) - 1;
+ return scalar(keys %{$self->getOptions}) - 1;
}
#-------------------------------------------------------------------
@@ -168,7 +212,7 @@ Returns the initial position of the slider in slider units.
sub getSliderValue {
my $self = shift;
- my @keys = keys %{$self->get('options')};
+ my @keys = keys %{$self->getOptions};
for (my $i = 0; $i < @keys; $i++) {
return $i if $keys[$i] eq $self->get('value')->[0];
}
@@ -178,7 +222,7 @@ sub getSliderValue {
#-------------------------------------------------------------------
-=head2 getValueFromPost ( [ value ] )
+=head2 getValue ( [ value ] )
Retrieves a value from a form GET or POST and returns it. If the value comes
back as undef, this method will return the defaultValue instead. Strip
@@ -190,21 +234,33 @@ A value to process instead of POST input.
=cut
-sub getValueFromPost {
+sub getValue {
my $self = shift;
my @args = @_;
my $properties = {
-name => $self->get('name'),
-value => $self->get('value'),
- -options=> $self->get('options'),
+ -options=> $self->getOptions,
-id => 'view-'.$self->get('id'),
-size => 1,
};
- return WebGUI::Form::SelectList->new($self->session, $properties)->getValueFromPost(@args);
+ return WebGUI::Form::SelectList->new($self->session, $properties)->getValue(@args);
}
+#-------------------------------------------------------------------
+
+=head2 isDynamicCompatible ( )
+
+A class method that returns a boolean indicating whether this control is compatible with the DynamicField control.
+
+=cut
+
+sub isDynamicCompatible {
+ return 1;
+}
+
1;
diff --git a/lib/WebGUI/Form/Slider.pm b/lib/WebGUI/Form/Slider.pm
index 5ac98b962..7c41cc955 100644
--- a/lib/WebGUI/Form/Slider.pm
+++ b/lib/WebGUI/Form/Slider.pm
@@ -60,21 +60,13 @@ Defaults to "0". The minimum value that the slider can go to.
Defaults to 1. Setting this option to 0 will hide the input element tied to the
slider.
-=head4 profileEnabled
-
-Flag that tells the User Profile system that this is a valid form element in a User Profile
-
=cut
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
- my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
- formName=>{
- defaultValue=> "No name",
- },
maximum=>{
defaultValue=> "100",
},
@@ -84,9 +76,6 @@ sub definition {
editable=>{
defaultValue=> "1",
},
- profileEnabled=>{
- defaultValue=>0,
- },
});
return $class->SUPER::definition($session, $definition);
}
@@ -156,6 +145,19 @@ sub getInputVariable {
#-------------------------------------------------------------------
+=head2 getName ( session )
+
+Returns the human readable name of this control.
+
+=cut
+
+sub getName {
+ my ($self, $session) = @_;
+ return WebGUI::International->new($session, 'WebGUI')->get('slider');
+}
+
+#-------------------------------------------------------------------
+
=head2 getOnChangeInputElement ( )
This method should return the javascript code that should be executed on an
diff --git a/lib/WebGUI/Form/Submit.pm b/lib/WebGUI/Form/Submit.pm
index 3298f79aa..85c8f301f 100644
--- a/lib/WebGUI/Form/Submit.pm
+++ b/lib/WebGUI/Form/Submit.pm
@@ -38,23 +38,15 @@ The following methods are specifically available from this class. Check the supe
#-------------------------------------------------------------------
-=head2 definition ( )
+=head2 getName ( session )
-See the super class for additional details.
+Returns the human readable name of this control.
=cut
-sub definition {
- my $class = shift;
- my $session = shift;
- my $definition = shift || [];
- my $i18n = WebGUI::International->new($session);
- push(@{$definition}, {
- formName=>{
- defaultValue=>$i18n->get("submit")
- },
- });
- return $class->SUPER::definition($session, $definition);
+sub getName {
+ my ($self, $session) = @_;
+ return WebGUI::International->new($session, 'WebGUI')->get('submit');
}
#-------------------------------------------------------------------
@@ -67,7 +59,7 @@ Renders a button.
sub toHtml {
my $self = shift;
- my $value = $self->fixQuotes($self->get("value"));
+ my $value = $self->fixQuotes($self->getDefaultValue);
my $extras = $self->get("extras") || q|class="forwardButton"|;
my $i18n = WebGUI::International->new($self->session);
$self->{_params}{extras} ||= 'onclick="this.value=\''.$i18n->get(452).'\'"';
diff --git a/lib/WebGUI/Form/SubscriptionGroup.pm b/lib/WebGUI/Form/SubscriptionGroup.pm
index f1e2ef0da..cc0ab8223 100644
--- a/lib/WebGUI/Form/SubscriptionGroup.pm
+++ b/lib/WebGUI/Form/SubscriptionGroup.pm
@@ -36,36 +36,18 @@ The following methods are specifically available from this class. Check the supe
=cut
+
#-------------------------------------------------------------------
-=head2 definition ( [ additionalTerms ] )
+=head2 getName ( session )
-See the super class for additional details.
-
-=head3 additionalTerms
-
-The following additional parameters have been added via this sub class.
-
-=head4 profileEnabled
-
-Flag that tells the User Profile system that this is a valid form element in a User Profile
+Returns the human readable name of this control.
=cut
-sub definition {
- my $class = shift;
- my $session = shift;
- my $definition = shift || [];
- my $i18n = WebGUI::International->new($session);
- push(@{$definition}, {
- formName=>{
- defaultValue=>$i18n->get("hidden")
- },
- profileEnabled=>{
- defaultValue=>0
- },
- });
- return $class->SUPER::definition($session, $definition);
+sub getName {
+ my ($self, $session) = @_;
+ return WebGUI::International->new($session, 'WebGUI')->get('SubscriptionGroup formName');
}
#-------------------------------------------------------------------
@@ -78,7 +60,7 @@ Renders the form field to HTML as a table row. The row is not displayed because
sub toHtmlWithWrapper {
my $self = shift;
- my $value = $self->fixMacros($self->fixQuotes($self->fixSpecialCharacters($self->get("value")))) || '';
+ my $value = $self->fixMacros($self->fixQuotes($self->fixSpecialCharacters($self->getDefaultValue))) || '';
my $manageButton = " ";
if($value) {
diff --git a/lib/WebGUI/Form/Template.pm b/lib/WebGUI/Form/Template.pm
index 02db443d9..bb853d55e 100644
--- a/lib/WebGUI/Form/Template.pm
+++ b/lib/WebGUI/Form/Template.pm
@@ -39,6 +39,18 @@ The following methods are specifically available from this class. Check the supe
#-------------------------------------------------------------------
+=head2 areOptionsSettable ( )
+
+Returns 0.
+
+=cut
+
+sub areOptionsSettable {
+ return 0;
+}
+
+#-------------------------------------------------------------------
+
=head2 definition ( [ additionalTerms ] )
See the super class for additional details.
@@ -71,9 +83,6 @@ sub definition {
my $definition = shift || [];
my $i18n = WebGUI::International->new($session, 'Asset_Template');
push(@{$definition}, {
- formName=>{
- defaultValue=>$i18n->get("assetName")
- },
label=>{
defaultValue=>$i18n->get("assetName")
},
@@ -86,15 +95,49 @@ sub definition {
onlyCommitted=>{
defaultValue=>''
},
- dbDataType => {
- defaultValue => "VARCHAR(22) BINARY",
- },
- });
+ });
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
+=head2 getDatabaseFieldType ( )
+
+Returns "VARCHAR(22) BINARY".
+
+=cut
+
+sub getDatabaseFieldType {
+ return "VARCHAR(22) BINARY";
+}
+
+#-------------------------------------------------------------------
+
+=head2 getName ( session )
+
+Returns the human readable name of this control.
+
+=cut
+
+sub getName {
+ my ($self, $session) = @_;
+ return WebGUI::International->new($session, 'Asset_Template')->get('assetName');
+}
+
+#-------------------------------------------------------------------
+
+=head2 isDynamicCompatible ( )
+
+Returns 0.
+
+=cut
+
+sub isDynamicCompatible {
+ return 0;
+}
+
+#-------------------------------------------------------------------
+
=head2 toHtml ( )
Renders a template picker control.
diff --git a/lib/WebGUI/Form/Text.pm b/lib/WebGUI/Form/Text.pm
index 929721246..fd3d89292 100644
--- a/lib/WebGUI/Form/Text.pm
+++ b/lib/WebGUI/Form/Text.pm
@@ -54,37 +54,39 @@ Defaults to 255. Determines the maximum number of characters allowed in this fie
Defaults to the setting textBoxSize or 30 if that's not set. Specifies how big of a text box to display.
-=head4 profileEnabled
-
-Flag that tells the User Profile system that this is a valid form element in a User Profile
-
=cut
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
- my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
- formName=>{
- defaultValue=> $i18n->get("475")
- },
maxlength=>{
defaultValue=> 255
},
size=>{
defaultValue=>$session->setting->get("textBoxSize") || 30
},
- profileEnabled=>{
- defaultValue=>1
- },
});
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
-=head2 getValueFromPost ( [ value ] )
+=head2 getName ( session )
+
+Returns the human readable name of this control.
+
+=cut
+
+sub getName {
+ my ($self, $session) = @_;
+ return WebGUI::International->new($session, 'WebGUI')->get('475');
+}
+
+#-------------------------------------------------------------------
+
+=head2 getValue ( [ value ] )
Retrieves a value from a form GET or POST and returns it. If the value comes back as undef, this method will return the defaultValue instead. Strip newlines/carriage returns from the value.
@@ -94,22 +96,23 @@ An optional value to process, instead of POST input.
=cut
-sub getValueFromPost {
+sub getValue {
my $self = shift;
- my $formValue;
+ my $value = $self->SUPER::getValue(@_);
+ $value =~ tr/\n\n//d;
+ return $value;
+}
- if (@_) {
- $formValue = shift;
- }
- elsif ($self->session->request) {
- $formValue = $self->session->form->param($self->get("name"));
- }
- if (defined $formValue) {
- $formValue =~ tr/\r\n//d;
- return $formValue;
- } else {
- return $self->{defaultValue};
- }
+#-------------------------------------------------------------------
+
+=head2 isDynamicCompatible ( )
+
+A class method that returns a boolean indicating whether this control is compatible with the DynamicField control.
+
+=cut
+
+sub isDynamicCompatible {
+ return 1;
}
#-------------------------------------------------------------------
@@ -122,7 +125,7 @@ Renders an input tag of type text.
sub toHtml {
my $self = shift;
- my $value = $self->fixMacros($self->fixQuotes($self->fixSpecialCharacters($self->get("value"))));
+ my $value = $self->fixMacros($self->fixQuotes($self->fixSpecialCharacters($self->getDefaultValue)));
return 'get("extras").' />';
}
diff --git a/lib/WebGUI/Form/Textarea.pm b/lib/WebGUI/Form/Textarea.pm
index 7729a5e77..e7a5ec369 100644
--- a/lib/WebGUI/Form/Textarea.pm
+++ b/lib/WebGUI/Form/Textarea.pm
@@ -58,10 +58,6 @@ The height of this control in pixels. Defaults to 150 pixels.
Style attributes besides width and height which should be specified using the above parameters. Be sure to escape quotes if you use any.
-=head4 profileEnabled
-
-Flag that tells the User Profile system that this is a valid form element in a User Profile
-
=head4 resizable
A boolean indicating whether the text area can be reized by users. Defaults to 1.
@@ -72,11 +68,7 @@ sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
- my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
- formName=>{
- defaultValue=>$i18n->get("476")
- },
height=>{
defaultValue=> 150
},
@@ -89,18 +81,49 @@ sub definition {
resizable => {
defaultValue => 1,
},
- profileEnabled=>{
- defaultValue=>1
- },
- dbDataType => {
- defaultValue => "LONGTEXT",
- },
});
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
+=head2 getDatabaseFieldType ( )
+
+Returns "LONGTEXT".
+
+=cut
+
+sub getDatabaseFieldType {
+ return "LONGTEXT";
+}
+
+#-------------------------------------------------------------------
+
+=head2 getName ( session )
+
+Returns the human readable name of this control.
+
+=cut
+
+sub getName {
+ my ($self, $session) = @_;
+ return WebGUI::International->new($session, 'WebGUI')->get('476');
+}
+
+#-------------------------------------------------------------------
+
+=head2 isDynamicCompatible ( )
+
+A class method that returns a boolean indicating whether this control is compatible with the DynamicField control.
+
+=cut
+
+sub isDynamicCompatible {
+ return 1;
+}
+
+#-------------------------------------------------------------------
+
=head2 toHtml ( )
Renders an input tag of type text.
@@ -109,7 +132,7 @@ Renders an input tag of type text.
sub toHtml {
my $self = shift;
- my $value = $self->fixMacros($self->fixTags($self->fixSpecialCharacters($self->get("value"))));
+ my $value = $self->fixMacros($self->fixTags($self->fixSpecialCharacters($self->getDefaultValue)));
my $width = $self->get('width') || 400;
my $height = $self->get('height') || 150;
my ($style, $url) = $self->session->quick(qw(style url));
diff --git a/lib/WebGUI/Form/TimeField.pm b/lib/WebGUI/Form/TimeField.pm
index f34715e11..fdcbab845 100644
--- a/lib/WebGUI/Form/TimeField.pm
+++ b/lib/WebGUI/Form/TimeField.pm
@@ -66,21 +66,13 @@ Defaults to 8. Determines the maximum number of characters allowed in this field
Default to 8. Determines how many characters wide the field wlll be.
-=head4 profileEnabled
-
-Flag that tells the User Profile system that this is a valid form element in a User Profile
-
=cut
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
- my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
- formName=>{
- defaultValue=>$i18n->get("971")
- },
maxlength=>{
defaultValue=>8
},
@@ -89,12 +81,6 @@ sub definition {
},
format => {
defaultValue => undef,
- },
- profileEnabled=>{
- defaultValue=>1
- },
- dbDataType => {
- defaultValue => "BIGINT",
},
});
return $class->SUPER::definition($session, $definition);
@@ -102,7 +88,32 @@ sub definition {
#-------------------------------------------------------------------
-=head2 getValueFromPost ( [ value ] )
+=head2 getDatabaseFieldType ( )
+
+Returns "BIGINT".
+
+=cut
+
+sub getDatabaseFieldType {
+ return "BIGINT";
+}
+
+#-------------------------------------------------------------------
+
+=head2 getName ( session )
+
+Returns the human readable name of this control.
+
+=cut
+
+sub getName {
+ my ($self, $session) = @_;
+ return WebGUI::International->new($session, 'WebGUI')->get('971');
+}
+
+#-------------------------------------------------------------------
+
+=head2 getValue ( [ value ] )
If the defaultValue is a MySQL time, the value returned by this form element
will be a MySQL time. Note: Will not be adjusted for the user's time zone.
@@ -116,11 +127,10 @@ An optional value to process, instead of POST input. This should be in the form
=cut
-sub getValueFromPost {
+sub getValue {
my $self = shift;
-
+ my $value = $self->SUPER::getValue(@_);
if (@_) {
- my $value = shift;
if ($self->get('format') ne 'mysql' && (
!$self->get("defaultValue")
|| $self->get("defaultValue") =~ m/^\d+$/
@@ -143,10 +153,10 @@ sub getValueFromPost {
|| !$self->get("value")
|| $self->get("value") =~ m/^\d+$/)) {
# epoch format
- return $self->session->datetime->timeToSeconds($self->session->form->param($self->get("name")))-($self->session->user->profileField("timeOffset")*3600);
- } else {
+ return $self->session->datetime->timeToSeconds($value)-($self->session->user->profileField("timeOffset")*3600);
+ }
+ else {
# Mysql format
- my $value = $self->session->form->param($self->get("name"));
return undef unless $value =~ /^\d{2}\D\d{2}(\D\d{2})?$/;
return $value;
}
@@ -154,6 +164,18 @@ sub getValueFromPost {
#-------------------------------------------------------------------
+=head2 isDynamicCompatible ( )
+
+A class method that returns a boolean indicating whether this control is compatible with the DynamicField control.
+
+=cut
+
+sub isDynamicCompatible {
+ return 1;
+}
+
+#-------------------------------------------------------------------
+
=head2 toHtml ( )
Renders a time field.
@@ -162,18 +184,7 @@ Renders a time field.
sub toHtml {
my $self = shift;
- my $value;
- # This should probably be rewritten as a cascading ternary
- if (!$self->get("defaultValue")
- || $self->get("defaultValue") =~ m/^\d+$/
- || !$self->get("value")
- || $self->get("value") =~ m/^\d+$/) {
- # Epoch format
- $value = $self->session->datetime->secondsToTime($self->get("value"));
- } else {
- # MySQL format
- $value = $self->get("value");
- }
+ my $value = $self->getDefaultValue;
my $i18n = WebGUI::International->new($self->session);
$self->session->style->setScript($self->session->url->extras('inputCheck.js'),{ type=>'text/javascript' });
$self->set("extras", $self->get('extras') . ' onkeyup="doInputCheck(document.getElementById(\''.$self->get("id").'\'),\'0123456789:\')"');
@@ -195,18 +206,7 @@ Renders the field as a hidden field.
sub toHtmlAsHidden {
my $self = shift;
- my $value;
- # This should probably be rewritten as a cascading ternary
- if (!$self->get("defaultValue")
- || $self->get("defaultValue") =~ m/^\d+$/
- || !$self->get("value")
- || $self->get("value") =~ m/^\d+$/) {
- # Epoch format
- $value = $self->session->datetime->secondsToTime($self->get("value"));
- } else {
- # MySQL format
- $value = $self->get("value");
- }
+ my $value = $self->getDefaultValue;
return WebGUI::Form::Hidden->new($self->session,
name=>$self->get("name"),
value=>$value
diff --git a/lib/WebGUI/Form/TimeZone.pm b/lib/WebGUI/Form/TimeZone.pm
index 2e9a160ef..7bfaa3ffb 100644
--- a/lib/WebGUI/Form/TimeZone.pm
+++ b/lib/WebGUI/Form/TimeZone.pm
@@ -38,6 +38,18 @@ The following methods are specifically available from this class. Check the supe
#-------------------------------------------------------------------
+=head2 areOptionsSettable ( )
+
+Returns 0.
+
+=cut
+
+sub areOptionsSettable {
+ return 0;
+}
+
+#-------------------------------------------------------------------
+
=head2 definition ( )
See the super class for additional details.
@@ -48,16 +60,37 @@ sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
- my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
- formName=>{
- defaultValue=>$i18n->get("timezone", 'DateTime')
- },
value=>{
defaultValue=>undef
},
- });
- return $class->SUPER::definition($session, $definition);
+ });
+ return $class->SUPER::definition($session, $definition);
+}
+
+#-------------------------------------------------------------------
+
+=head2 getName ( session )
+
+Returns the human readable name of this control.
+
+=cut
+
+sub getName {
+ my ($self, $session) = @_;
+ return WebGUI::International->new($session, 'DateTime')->get('timezone');
+}
+
+#-------------------------------------------------------------------
+
+=head2 isDynamicCompatible ( )
+
+A class method that returns a boolean indicating whether this control is compatible with the DynamicField control.
+
+=cut
+
+sub isDynamicCompatible {
+ return 1;
}
#-------------------------------------------------------------------
diff --git a/lib/WebGUI/Form/Url.pm b/lib/WebGUI/Form/Url.pm
index 4347d5b7e..a60081038 100644
--- a/lib/WebGUI/Form/Url.pm
+++ b/lib/WebGUI/Form/Url.pm
@@ -50,10 +50,6 @@ The following additional parameters have been added via this sub class.
Defaults to 2048. Determines the maximum number of characters allowed in this field.
-=head4 profileEnabled
-
-Flag that tells the User Profile system that this is a valid form element in a User Profile
-
=cut
sub definition {
@@ -62,36 +58,45 @@ sub definition {
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
- formName=>{
- defaultValue=>$i18n->get("478")
- },
maxlength=>{
defaultValue=> 2048
},
- profileEnabled=>{
- defaultValue=>1
- },
});
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
-=head2 getValueFromPost ( )
+=head2 getName ( session )
+
+Returns the human readable name of this control.
+
+=cut
+
+sub getName {
+ my ($self, $session) = @_;
+ return WebGUI::International->new($session, 'WebGUI')->get('478');
+}
+
+#-------------------------------------------------------------------
+
+=head2 getValue ( )
Parses the posted value and tries to make corrections if necessary.
=cut
-sub getValueFromPost {
+sub getValue {
my $self = shift;
- my $value = @_ ? shift : $self->session->form->param($self->get("name"));
+ my $value = $self->SUPER::getValue(@_);
$value =~ tr/\r\n//d;
if ($value =~ /mailto:/) {
return $value;
- } elsif ($value =~ /^([A-Z0-9]+[._+-]?){1,}([A-Z0-9]+[_+-]?)+\@(([A-Z0-9]+[._-]?){1,}[A-Z0-9]+\.){1,}[A-Z]{2,4}$/i) {
+ }
+ elsif ($value =~ /^([A-Z0-9]+[._+-]?){1,}([A-Z0-9]+[_+-]?)+\@(([A-Z0-9]+[._-]?){1,}[A-Z0-9]+\.){1,}[A-Z]{2,4}$/i) {
return "mailto:".$value;
- } elsif ($value =~ /^\// || $value =~ /:\/\// || $value =~ /^\^/) {
+ }
+ elsif ($value =~ /^\// || $value =~ /:\/\// || $value =~ /^\^/) {
return $value;
}
return "http://".$value;
@@ -99,6 +104,33 @@ sub getValueFromPost {
#-------------------------------------------------------------------
+=head2 getValueAsHtml ( )
+
+Formats as a link.
+
+=cut
+
+sub getValueAsHtml {
+ my $self = shift;
+ my $url = $self->getValue;
+ return ''.$url.'';
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 isDynamicCompatible ( )
+
+A class method that returns a boolean indicating whether this control is compatible with the DynamicField control.
+
+=cut
+
+sub isDynamicCompatible {
+ return 1;
+}
+
+#-------------------------------------------------------------------
+
=head2 toHtml ( )
Renders a URL field.
@@ -106,7 +138,7 @@ Renders a URL field.
=cut
sub toHtml {
- my $self = shift;
+ my $self = shift;
$self->session->style->setScript($self->session->url->extras('addHTTP.js'),{ type=>'text/javascript' });
$self->set("extras", $self->get('extras') . ' onblur="addHTTP(this.form.'.$self->get("name").')"');
return $self->SUPER::toHtml;
diff --git a/lib/WebGUI/Form/User.pm b/lib/WebGUI/Form/User.pm
index a9f312cca..97d9f3bb3 100644
--- a/lib/WebGUI/Form/User.pm
+++ b/lib/WebGUI/Form/User.pm
@@ -69,9 +69,6 @@ sub definition {
my $definition = shift || [];
my $i18n = WebGUI::International->new($session, "WebGUI");
push(@{$definition}, {
- formName=>{
- defaultValue=>$i18n->get("user"),
- },
label=>{
defaultValue=>$i18n->get("user"),
},
@@ -81,15 +78,67 @@ sub definition {
readOnly=>{
defaultValue=>0,
},
- dbDataType => {
- defaultValue => "VARCHAR(22) BINARY",
- },
});
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
+=head2 getDatabaseFieldType ( )
+
+Returns "VARCHAR(22) BINARY".
+
+=cut
+
+sub getDatabaseFieldType {
+ return "VARCHAR(22) BINARY";
+}
+
+#-------------------------------------------------------------------
+
+=head2 getName ( session )
+
+Returns the human readable name of this control.
+
+=cut
+
+sub getName {
+ my ($self, $session) = @_;
+ return WebGUI::International->new($session, 'WebGUI')->get('user');
+}
+
+#-------------------------------------------------------------------
+
+=head2 getValueAsHtml ( )
+
+Formats as a name.
+
+=cut
+
+sub getValueAsHtml {
+ my $self = shift;
+ my $user = WebGUI::User->new($self->session, $self->getValue);
+ if (defined $user) {
+ return $user->username;
+ }
+ return undef;
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 isDynamicCompatible ( )
+
+A class method that returns a boolean indicating whether this control is compatible with the DynamicField control.
+
+=cut
+
+sub isDynamicCompatible {
+ return 1;
+}
+
+#-------------------------------------------------------------------
+
=head2 toHtml ( )
Renders a user selector.
@@ -98,7 +147,7 @@ Renders a user selector.
sub toHtml {
my $self = shift;
- my $user = WebGUI::User->new($self->session, $self->get("value"));
+ my $user = WebGUI::User->new($self->session, $self->getDefaultValue);
my $manage = undef;
if ($self->session->user->isInGroup(3)) {
$manage = " ".$self->session->icon->manage('op=listUsers');
diff --git a/lib/WebGUI/Form/WhatNext.pm b/lib/WebGUI/Form/WhatNext.pm
index 92191e03d..e119c7326 100644
--- a/lib/WebGUI/Form/WhatNext.pm
+++ b/lib/WebGUI/Form/WhatNext.pm
@@ -62,9 +62,6 @@ sub definition {
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
- formName=>{
- defaultValue=>$i18n->get("744")
- },
label=>{
defaultValue=>$i18n->get("744")
},
@@ -77,6 +74,31 @@ sub definition {
#-------------------------------------------------------------------
+=head2 getName ( session )
+
+Returns the human readable name of this control.
+
+=cut
+
+sub getName {
+ my ($self, $session) = @_;
+ return WebGUI::International->new($session, 'WebGUI')->get('744');
+}
+
+#-------------------------------------------------------------------
+
+=head2 isDynamicCompatible ( )
+
+Returns 0.
+
+=cut
+
+sub isDynamicCompatible {
+ return 0;
+}
+
+#-------------------------------------------------------------------
+
=head2 toHtml ( )
Renders a question selector asking the user where they want to go.
diff --git a/lib/WebGUI/Form/Workflow.pm b/lib/WebGUI/Form/Workflow.pm
index 7aec8649b..2ae9b46fc 100644
--- a/lib/WebGUI/Form/Workflow.pm
+++ b/lib/WebGUI/Form/Workflow.pm
@@ -39,6 +39,18 @@ The following methods are specifically available from this class. Check the supe
#-------------------------------------------------------------------
+=head2 areOptionsSettable ( )
+
+Returns 0.
+
+=cut
+
+sub areOptionsSettable {
+ return 0;
+}
+
+#-------------------------------------------------------------------
+
=head2 definition ( [ additionalTerms ] )
See the super class for additional details.
@@ -74,11 +86,8 @@ sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
- my $i18n = WebGUI::International->new($session, 'Workflow');
+ my $i18n = WebGUI::International->new($session, 'Workflow');
push(@{$definition}, {
- formName=>{
- defaultValue=>$i18n->get("topicName")
- },
label=>{
defaultValue=>$i18n->get("topicName")
},
@@ -94,11 +103,33 @@ sub definition {
includeRealtime => {
defaultValue => 0
},
- dbDataType => {
- defaultValue => "VARCHAR(22) BINARY",
- },
- });
- return $class->SUPER::definition($session, $definition);
+ });
+ return $class->SUPER::definition($session, $definition);
+}
+
+#-------------------------------------------------------------------
+
+=head2 getDatabaseFieldType ( )
+
+Returns "VARCHAR(22) BINARY".
+
+=cut
+
+sub getDatabaseFieldType {
+ return "VARCHAR(22) BINARY";
+}
+
+#-------------------------------------------------------------------
+
+=head2 getName ( session )
+
+Returns the human readable name of this control.
+
+=cut
+
+sub getName {
+ my ($self, $session) = @_;
+ return WebGUI::International->new($session, 'Workflow')->get('topicName');
}
#-------------------------------------------------------------------
@@ -130,7 +161,6 @@ sub toHtmlWithWrapper {
my $returnUrl = ";proceed=goBackToPage;returnUrl=".$self->session->url->escape($self->session->asset->getUrl) if $self->session->asset;
my $buttons;
# This edit button will not work with multiple workflows.
- #$buttons .= $self->session->icon->edit("op=editWorkflow;workflowId=".$self->get("value")->[0].$returnUrl) if ($self->get("value"));
$buttons .= $self->session->icon->manage("op=manageWorkflows".$returnUrl);
$self->set("subtext",$buttons . $self->get("subtext"));
return $self->SUPER::toHtmlWithWrapper;
diff --git a/lib/WebGUI/Form/YesNo.pm b/lib/WebGUI/Form/YesNo.pm
index 577613bb4..364c13a7c 100644
--- a/lib/WebGUI/Form/YesNo.pm
+++ b/lib/WebGUI/Form/YesNo.pm
@@ -51,53 +51,48 @@ The following additional parameters have been added via this sub class.
Can be a 1 or 0. Defaults to 0 if no value is specified.
-=head4 profileEnabled
-
-Flag that tells the User Profile system that this is a valid form element in a User Profile
-
=cut
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
- my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
- formName=>{
- defaultValue=>$i18n->get("483")
- },
defaultValue=>{
defaultValue=>0
},
- profileEnabled=>{
- defaultValue=>1
- },
- dbDataType => {
- defaultValue => "bool",
- },
});
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
-=head2 yesNo ( )
+=head2 getDatabaseFieldType ( )
-Returns either a 1 or 0 representing yes, no.
+Returns "BOOLEAN".
-=cut
+=cut
-sub yesNo {
- my $self = shift;
- if ($self->session->form->param($self->get("name")) > 0) {
- return 1;
- }
- return 0;
+sub getDatabaseFieldType {
+ return "BOOLEAN";
}
#-------------------------------------------------------------------
-=head2 getValueFromPost ( [ value ] )
+=head2 getName ( session )
+
+Returns the human readable name of this control.
+
+=cut
+
+sub getName {
+ my ($self, $session) = @_;
+ return WebGUI::International->new($session, 'WebGUI')->get('483');
+}
+
+#-------------------------------------------------------------------
+
+=head2 getValue ( [ value ] )
If value is present, we will process it, otherwise the superclass will handle the request.
@@ -107,15 +102,43 @@ An optional value to process, instead of POST input. This should be in the form
=cut
-sub getValueFromPost {
+sub getValue {
my $self = shift;
- my $value = shift;
- $value = $self->SUPER::getValueFromPost unless (defined $value);
+ my $value = $self->SUPER::getValue(@_);
return ($value =~ /^y/i || $value eq '1') ? 1 : 0;
}
#-------------------------------------------------------------------
+=head2 getValueAsHtml ()
+
+Shows either Yes or No.
+
+=cut
+
+sub getValueAsHtml {
+ my $self = shift;
+ my $i18n = WebGUI::International->new($self->session);
+ if ($self->getValue) {
+ return $i18n->get(138);
+ }
+ return $i18n->get(139);
+}
+
+#-------------------------------------------------------------------
+
+=head2 isDynamicCompatible ( )
+
+A class method that returns a boolean indicating whether this control is compatible with the DynamicField control.
+
+=cut
+
+sub isDynamicCompatible {
+ return 1;
+}
+
+#-------------------------------------------------------------------
+
=head2 toHtml ( )
Renders a yes/no question field.
@@ -126,7 +149,7 @@ sub toHtml {
my $self = shift;
my $i18n = WebGUI::International->new($self->session);
my ($checkYes, $checkNo);
- if ($self->get("value")) {
+ if ($self->getDefaultValue) {
$checkYes = 1;
} else {
$checkNo = 1;
diff --git a/lib/WebGUI/Form/Zipcode.pm b/lib/WebGUI/Form/Zipcode.pm
index 7ea115555..65e65dfdf 100644
--- a/lib/WebGUI/Form/Zipcode.pm
+++ b/lib/WebGUI/Form/Zipcode.pm
@@ -50,34 +50,36 @@ The following additional parameters have been added via this sub class.
Defaults to 10. Determines the maximum number of characters allowed in this field.
-=head4 profileEnabled
-
-Flag that tells the User Profile system that this is a valid form element in a User Profile
-
=cut
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
- my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
- formName=>{
- defaultValue=> $i18n->get("944")
- },
maxlength=>{
defaultValue=> 10
},
- profileEnabled=>{
- defaultValue=>1
- },
});
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
-=head2 getValueFromPost ( [ value ] )
+=head2 getName ( session )
+
+Returns the human readable name of this control.
+
+=cut
+
+sub getName {
+ my ($self, $session) = @_;
+ return WebGUI::International->new($session, 'WebGUI')->get('944');
+}
+
+#-------------------------------------------------------------------
+
+=head2 getValue ( [ value ] )
Returns a validated form post result. If the result does not pass validation, it returns undef instead.
@@ -87,9 +89,9 @@ An optional value to use instead of POST input.
=cut
-sub getValueFromPost {
+sub getValue {
my $self = shift;
- my $value = @_ ? shift : $self->session->form->param($self->get("name"));
+ my $value = $self->SUPER::getValue(@_);
$value =~ tr/\r\n//d;
if ($value =~ /^[A-Z\d\s\-]+$/) {
return $value;
@@ -99,6 +101,18 @@ sub getValueFromPost {
#-------------------------------------------------------------------
+=head2 isDynamicCompatible ( )
+
+A class method that returns a boolean indicating whether this control is compatible with the DynamicField control.
+
+=cut
+
+sub isDynamicCompatible {
+ return 1;
+}
+
+#-------------------------------------------------------------------
+
=head2 toHtml ( )
Renders a zip code field.
diff --git a/lib/WebGUI/Form/_control.skeleton b/lib/WebGUI/Form/_control.skeleton
index f2baf4e7a..d8a94ff63 100644
--- a/lib/WebGUI/Form/_control.skeleton
+++ b/lib/WebGUI/Form/_control.skeleton
@@ -50,58 +50,49 @@ The following additional parameters have been added via this sub class.
Defaults to the setting textBoxSize or 30 if that's not set. Specifies how big of a text box to display.
-=head4 profileEnabled
-
-Flag that tells the User Profile system that this is a valid form element in a User Profile
-
=cut
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
- my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
- formName=>{
- defaultValue=> $i18n->get("475")
- },
size=>{
defaultValue=>$session->setting->get("textBoxSize") || 30
},
- profileEnabled=>{
- defaultValue=>1
- },
});
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
-=head2 getValueFromPost ( [ value ] )
+=head2 getName ( session )
-Retrieves a value from a form GET or POST and returns it. If the value comes back as undef, this method will return the defaultValue instead.
-
-=head3 value
-
-An optional value to process, instead of POST input.
+Returns the name of the form control.
=cut
-sub getValueFromPost {
- my $self = shift;
- my $formValue;
+sub getName {
+ my ($class, $session) = @_;
+ return WebGUI::International->new($session, "Form_MyControl")>get("topicName");
+}
- if (@_) {
- $formValue = shift;
- }
- elsif ($self->session->request) {
- $formValue = $self->session->form->param($self->get("name"));
- }
- if (defined $formValue) {
- return $formValue;
- } else {
- return $self->{defaultValue};
- }
+
+#-------------------------------------------------------------------
+
+=head2 getValue ( [ value ] )
+
+Does some special processing.
+
+=cut
+
+sub getValue {
+ my $self = shift;
+ my $value = $self->SUPER::getValue(@_);
+
+ # ... do your work here
+
+ return $value;
}
#-------------------------------------------------------------------
@@ -114,7 +105,7 @@ Renders an input tag of type text.
sub toHtml {
my $self = shift;
- my $value = $self->fixMacros($self->fixQuotes($self->fixSpecialCharacters($self->get("value"))));
+ my $value = $self->fixMacros($self->fixQuotes($self->fixSpecialCharacters($self->getDefaultValue)));
return 'get("extras").' />';
}
diff --git a/lib/WebGUI/FormValidator.pm b/lib/WebGUI/FormValidator.pm
index b97322a97..0c03cbe60 100644
--- a/lib/WebGUI/FormValidator.pm
+++ b/lib/WebGUI/FormValidator.pm
@@ -76,7 +76,7 @@ sub AUTOLOAD {
$self->session->errorHandler->error($@);
return undef;
}
- return $control->getValueFromPost(@args);
+ return $control->getValue(@args);
}
#-------------------------------------------------------------------
diff --git a/lib/WebGUI/Operation/Graphics.pm b/lib/WebGUI/Operation/Graphics.pm
index fb6a1dacf..243e2d958 100644
--- a/lib/WebGUI/Operation/Graphics.pm
+++ b/lib/WebGUI/Operation/Graphics.pm
@@ -272,7 +272,7 @@ sub www_editFontSave {
if ($session->form->process('fid') eq 'new') {
- my $fileStorageId = WebGUI::Form::File->new($session,{name => 'fontFile'})->getValueFromPost;
+ my $fileStorageId = WebGUI::Form::File->new($session,{name => 'fontFile'})->getValue;
my $storage = WebGUI::Storage->get($session, $fileStorageId);
my $filename = $storage->getFiles()->[0];
diff --git a/lib/WebGUI/ProfileField.pm b/lib/WebGUI/ProfileField.pm
index fc848e000..e6a6f4511 100644
--- a/lib/WebGUI/ProfileField.pm
+++ b/lib/WebGUI/ProfileField.pm
@@ -122,7 +122,7 @@ sub create {
$properties->{fieldType} ||= "ReadOnly";
my $formClass = 'WebGUI::Form::' . ucfirst $properties->{fieldType};
eval "use $formClass;";
- my $dbDataType = $formClass->new($session, $self->formProperties($properties))->get("dbDataType");
+ my $dbDataType = $formClass->getDatabaseFieldType;
# Add the column to the userProfileData table
$db->write(
@@ -245,11 +245,11 @@ sub formField {
}
}
if ($withWrapper == 1) {
- return WebGUI::Form::DynamicField->new($self->session,%{$properties})->displayFormWithWrapper;
+ return WebGUI::Form::DynamicField->new($self->session,%{$properties})->toHtmlWithWrapper;
} elsif ($withWrapper == 2) {
- return WebGUI::Form::DynamicField->new($self->session,%{$properties})->displayValue;
+ return WebGUI::Form::DynamicField->new($self->session,%{$properties})->getValueAsHtml;
} else {
- return WebGUI::Form::DynamicField->new($self->session,%{$properties})->displayForm;
+ return WebGUI::Form::DynamicField->new($self->session,%{$properties})->toHtml;
}
}
@@ -592,7 +592,7 @@ sub rename {
# Rename the userProfileData column
my $fieldClass = $self->getFormControlClass;
eval "use $fieldClass;";
- my $dbDataType = $fieldClass->new($session, $self->formProperties)->get("dbDataType");
+ my $dbDataType = $fieldClass->getDatabaseFieldType;
$self->session->db->write(
"ALTER TABLE userProfileData "
@@ -698,7 +698,7 @@ sub set {
my $fieldClass = "WebGUI::Form::".ucfirst($properties->{fieldType});
eval "use $fieldClass;";
my $dbDataType
- = $fieldClass->new($session, $self->formProperties($properties))->get("dbDataType");
+ = $fieldClass->new($session, $self->formProperties($properties))->getDatabaseFieldType;
my $sql
= "ALTER TABLE userProfileData MODIFY COLUMN "
diff --git a/lib/WebGUI/i18n/English/WebGUI.pm b/lib/WebGUI/i18n/English/WebGUI.pm
index f93626a9d..cbbacd703 100644
--- a/lib/WebGUI/i18n/English/WebGUI.pm
+++ b/lib/WebGUI/i18n/English/WebGUI.pm
@@ -2639,6 +2639,24 @@ div.tabs {
lastUpdated => 1044705103
},
+ 'class name' => {
+ message => q|Class Name|,
+ lastUpdated => 0,
+ context=> 'Form Type Name, as in "Object Class Name"',
+ },
+
+ 'fieldType' => {
+ message => q|Field Type|,
+ lastUpdated => 0,
+ context=> 'form field type',
+ },
+
+ 'slider' => {
+ message => q|Slider|,
+ lastUpdated => 0,
+ context=> 'form field type that has a slide selector',
+ },
+
'980' => {
message => q|Empty this folder.|,
lastUpdated => 1055908341
diff --git a/t/Form/Checkbox.t b/t/Form/Checkbox.t
index 3010b0eac..54af4a8f5 100644
--- a/t/Form/Checkbox.t
+++ b/t/Form/Checkbox.t
@@ -108,5 +108,5 @@ WebGUI::Form_Checking::auto_check($session, $formType, $testBlock);
#
# test WebGUI::FormValidator::Checkbox(undef,@values)
#
-is(WebGUI::Form::Checkbox->new($session)->getValueFromPost('test'), 'test', '$cbox->getValueFromPost(arg)');
+is(WebGUI::Form::Checkbox->new($session)->getValue('test'), 'test', '$cbox->getValue(arg)');
is($session->form->checkbox(undef,'test'), 'test', 'WebGUI::FormValidator::checkbox');
diff --git a/t/Form/ClassName.t b/t/Form/ClassName.t
index 7642fecdd..dac7b087b 100644
--- a/t/Form/ClassName.t
+++ b/t/Form/ClassName.t
@@ -130,5 +130,5 @@ WebGUI::Form_Checking::auto_check($session, $formType, $testBlock);
#
# test WebGUI::FormValidator::ClassName(undef,@values)
#
-is(WebGUI::Form::ClassName->new($session)->getValueFromPost('t*est'), 'test', '$cname->getValueFromPost(arg)');
+is(WebGUI::Form::ClassName->new($session)->getValue('t*est'), 'test', '$cname->getValue(arg)');
is($session->form->className(undef,'t*est'), 'test', 'WebGUI::FormValidator::className');
diff --git a/t/Form/Email.t b/t/Form/Email.t
index 24b3e9d87..ab8bd9989 100644
--- a/t/Form/Email.t
+++ b/t/Form/Email.t
@@ -107,11 +107,11 @@ is($input->{maxlength}, 200, 'Checking maxlength param, set');
WebGUI::Form_Checking::auto_check($session, 'email', $testBlock);
-# just testing that getValueFromPost works with an argument
+# just testing that getValue works with an argument
my $email = WebGUI::Form::Email->new($session);
-is($email->getValueFromPost('james@plainblack.com'), 'james@plainblack.com', 'getValueFromPost(valid) returned a valid email');
-is($email->getValueFromPost('this*isn"t and@emailaddres,s'), undef, 'getValueFromPost(invalid) returned undef instead of an invalid email');
+is($email->getValue('james@plainblack.com'), 'james@plainblack.com', 'getValue(valid) returned a valid email');
+is($email->getValue('this*isn"t and@emailaddres,s'), undef, 'getValue(invalid) returned undef instead of an invalid email');
is($session->form->email(undef,'james@plainblack.com'), 'james@plainblack.com', '$form->email(valid) returned a valid email');
is($session->form->email(undef,'this*isn"t and@emailaddres,s'), undef, '$form->email(invalid) returned undef instead of an invalid email');
diff --git a/t/Form/Float.t b/t/Form/Float.t
index f078db745..6219a831d 100644
--- a/t/Form/Float.t
+++ b/t/Form/Float.t
@@ -143,11 +143,11 @@ is($input->{maxlength}, 20, 'set maxlength');
WebGUI::Form_Checking::auto_check($session, $formType, $testBlock);
-# just testing that getValueFromPost works with an argument
+# just testing that getValue works with an argument
my $float = WebGUI::Form::Float->new($session);
-is($float->getValueFromPost('112.233'), 112.233, 'Got a valid float');
-is($float->getValueFromPost('fred'), 0, 'Returned 0 instead of an invalid float');
+is($float->getValue('112.233'), 112.233, 'Got a valid float');
+is($float->getValue('fred'), 0, 'Returned 0 instead of an invalid float');
__END__
diff --git a/t/Form/Integer.t b/t/Form/Integer.t
index c6e45ce44..338ac910b 100644
--- a/t/Form/Integer.t
+++ b/t/Form/Integer.t
@@ -120,14 +120,14 @@ is($input->{maxlength}, 20, 'set maxlength');
WebGUI::Form_Checking::auto_check($session, $formType, $testBlock);
-# just testing that getValueFromPost works with an argument
+# just testing that getValue works with an argument
my $int = WebGUI::Form::Integer->new($session);
-is($int->getValueFromPost(-123456), -123456, 'getValueFromPost(-123456)');
-is($int->getValueFromPost('002300'), '002300', 'getValueFromPost(002300)');
-is($int->getValueFromPost('+123456'), 0, 'getValueFromPost(+123456)');
-is($int->getValueFromPost('123-456.'), 0, 'getValueFromPost(123-456.)');
-is($int->getValueFromPost(123.456), 0, 'getValueFromPost(123.456)');
+is($int->getValue(-123456), -123456, 'getValue(-123456)');
+is($int->getValue('002300'), '002300', 'getValue(002300)');
+is($int->getValue('+123456'), 0, 'getValue(+123456)');
+is($int->getValue('123-456.'), 0, 'getValue(123-456.)');
+is($int->getValue(123.456), 0, 'getValue(123.456)');
is($session->form->integer(undef,-123456), -123456, 'session->form->integer(undef,-123456)');
is($session->form->integer(undef,'002300'), '002300', 'session->form->integer(undef,002300)');
diff --git a/t/Form/Phone.t b/t/Form/Phone.t
index 8d897300c..f69913332 100644
--- a/t/Form/Phone.t
+++ b/t/Form/Phone.t
@@ -146,10 +146,10 @@ WebGUI::Form_Checking::auto_check($session, $formType, $testBlock);
# test that we can process non-POST values correctly
my $cntl = WebGUI::Form::Phone->new($session,{ defaultValue => 4242 });
-is($cntl->getValueFromPost('123-123-1234'), '123-123-1234', 'getValueFromPost(valid)');
-is($cntl->getValueFromPost('123/123-1234'), undef, 'getValueFromPost(invalid)');
-is($cntl->getValueFromPost(0), 0, 'zero');
-is($cntl->getValueFromPost(''), undef, '""');
+is($cntl->getValue('123-123-1234'), '123-123-1234', 'getValue(valid)');
+is($cntl->getValue('123/123-1234'), undef, 'getValue(invalid)');
+is($cntl->getValue(0), 0, 'zero');
+is($cntl->getValue(''), undef, '""');
is($session->form->phone(undef,'123-123-1234'), '123-123-1234', 'valid');
is($session->form->phone(undef,'123/123-1234'), undef, 'invalid');
is($session->form->phone(undef,0), 0, 'zero');
diff --git a/t/Form/SelectBox.t b/t/Form/SelectBox.t
index eb4bd66f3..d5fe5d859 100644
--- a/t/Form/SelectBox.t
+++ b/t/Form/SelectBox.t
@@ -110,11 +110,11 @@ WebGUI::Form_Checking::auto_check($session, $formType, $testBlock);
# test that we can process non-POST values correctly
my $cntl = WebGUI::Form::SelectBox->new($session,{ defaultValue => 4242 });
-is($cntl->getValueFromPost('text'), 'text', 'getValueFromPost(text)');
-is($cntl->getValueFromPost(42), 42, 'getValueFromPost(int)');
-is($cntl->getValueFromPost(0), 0, 'zero');
-is($cntl->getValueFromPost(''), '', '""');
-is($cntl->getValueFromPost(1,2,3), 1, 'list returns first item');
+is($cntl->getValue('text'), 'text', 'getValue(text)');
+is($cntl->getValue(42), 42, 'getValue(int)');
+is($cntl->getValue(0), 0, 'zero');
+is($cntl->getValue(''), '', '""');
+is($cntl->getValue(1,2,3), 1, 'list returns first item');
is($session->form->selectBox(undef,'text'), 'text', 'text');
is($session->form->selectBox(undef,42), 42, 'int');
is($session->form->selectBox(undef,0), 0, 'zero');
diff --git a/t/Form/Text.t b/t/Form/Text.t
index e8a20b534..c82552b18 100644
--- a/t/Form/Text.t
+++ b/t/Form/Text.t
@@ -116,10 +116,10 @@ WebGUI::Form_Checking::auto_check($session, $formType, $testBlock);
# test that we can process non-POST values correctly
my $cntl = WebGUI::Form::Text->new($session,{ defaultValue => 4242 });
-is($cntl->getValueFromPost('123-123-1234'), '123-123-1234', 'getValueFromPost(valid)');
-is($cntl->getValueFromPost(0), 0, 'zero');
-is($cntl->getValueFromPost(''), '', '""');
-is($cntl->getValueFromPost(undef), undef, 'undef returns undef');
+is($cntl->getValue('123-123-1234'), '123-123-1234', 'getValue(valid)');
+is($cntl->getValue(0), 0, 'zero');
+is($cntl->getValue(''), '', '""');
+is($cntl->getValue(undef), undef, 'undef returns undef');
is($session->form->text(undef,'123-123-1234'), '123-123-1234', 'valid');
is($session->form->text(undef,0), 0, 'zero');
is($session->form->text(undef,undef), undef, 'undef returns undef');
diff --git a/t/Form/Textarea.t b/t/Form/Textarea.t
index 5b035bc11..5b68f066d 100644
--- a/t/Form/Textarea.t
+++ b/t/Form/Textarea.t
@@ -95,11 +95,11 @@ is($input->value, 'Some & text in " here', 'Checking default value');
WebGUI::Form_Checking::auto_check($session, $formType, $testBlock);
-# just testing that getValueFromPost works with an argument
+# just testing that getValue works with an argument
my $txt = WebGUI::Form::Textarea->new($session);
-is($txt->getValueFromPost("some test here"), "some test here", 'getValueFromPost(text)');
-is($txt->getValueFromPost("some \ntest \r\nhere"), "some \ntest \r\nhere", 'getValueFromPost(newlines)');
+is($txt->getValue("some test here"), "some test here", 'getValue(text)');
+is($txt->getValue("some \ntest \r\nhere"), "some \ntest \r\nhere", 'getValue(newlines)');
is($session->form->textarea(undef,"some test here"), "some test here", 'session->form->textarea(undef,text)');
is($session->form->textarea(undef,"some \ntest \r\nhere"), "some \ntest \r\nhere", 'session->form->textarea(undef,newlines)');
diff --git a/t/Form/Url.t b/t/Form/Url.t
index c184852d4..926a402d5 100644
--- a/t/Form/Url.t
+++ b/t/Form/Url.t
@@ -134,13 +134,13 @@ WebGUI::Form_Checking::auto_check($session, 'Url', $testBlock);
# test that we can process non-POST values correctly
my $cntl = WebGUI::Form::Url->new($session,{ defaultValue => 4242 });
-is($cntl->getValueFromPost('mailto:whatever'), 'mailto:whatever', 'mailto processing');
-is($cntl->getValueFromPost('me@nowhere.com'), 'mailto:me@nowhere.com', 'email address processing');
-is($cntl->getValueFromPost('/'), '/', '/');
-is($cntl->getValueFromPost('://'), '://', '://');
-is($cntl->getValueFromPost('^'), '^', '^');
-is($cntl->getValueFromPost('mySite'), 'http://mySite', 'http://mySite');
-is($cntl->getValueFromPost('??**()!!'), 'http://??**()!!', 'random crap is passed through');
+is($cntl->getValue('mailto:whatever'), 'mailto:whatever', 'mailto processing');
+is($cntl->getValue('me@nowhere.com'), 'mailto:me@nowhere.com', 'email address processing');
+is($cntl->getValue('/'), '/', '/');
+is($cntl->getValue('://'), '://', '://');
+is($cntl->getValue('^'), '^', '^');
+is($cntl->getValue('mySite'), 'http://mySite', 'http://mySite');
+is($cntl->getValue('??**()!!'), 'http://??**()!!', 'random crap is passed through');
is($session->form->url(undef,'mailto:whatever'), 'mailto:whatever', 'mailto processing');
is($session->form->url(undef,'me@nowhere.com'), 'mailto:me@nowhere.com', 'email address processing');
diff --git a/t/Form/Zipcode.t b/t/Form/Zipcode.t
index 4f7aa3ee1..1a36aa592 100644
--- a/t/Form/Zipcode.t
+++ b/t/Form/Zipcode.t
@@ -120,11 +120,11 @@ WebGUI::Form_Checking::auto_check($session, 'Zipcode', $testBlock);
# test that we can process non-POST values correctly
my $cntl = WebGUI::Form::Zipcode->new($session,{ defaultValue => 4242 });
-is($cntl->getValueFromPost('ABCDE'), 'ABCDE', 'alpha');
-is($cntl->getValueFromPost('02468'), '02468', 'numeric');
-is($cntl->getValueFromPost('NO WHERE'), 'NO WHERE', 'alpha space');
-is($cntl->getValueFromPost('-'), '-', 'bare dash');
-is($cntl->getValueFromPost('abcde'), undef, 'lower case');
+is($cntl->getValue('ABCDE'), 'ABCDE', 'alpha');
+is($cntl->getValue('02468'), '02468', 'numeric');
+is($cntl->getValue('NO WHERE'), 'NO WHERE', 'alpha space');
+is($cntl->getValue('-'), '-', 'bare dash');
+is($cntl->getValue('abcde'), undef, 'lower case');
is($session->form->zipcode(undef,'ABCDE'), 'ABCDE', 'alpha');
is($session->form->zipcode(undef,'02468'), '02468', 'numeric');