diff --git a/lib/WebGUI/Crud.pm b/lib/WebGUI/Crud.pm index 5ad86f073..7af828c6e 100644 --- a/lib/WebGUI/Crud.pm +++ b/lib/WebGUI/Crud.pm @@ -24,6 +24,7 @@ use Tie::IxHash; use Clone qw/clone/; use WebGUI::DateTime; use WebGUI::Exception; +use WebGUI::HTMLForm; has session => ( is => 'ro', @@ -369,6 +370,29 @@ sub crud_dropTable { #------------------------------------------------------------------- +=head2 crud_form ( $form, [$object] ) + +A class method to populate a WebGUI::HTMLForm object with all the fields for this Cruddy object. + +=head3 $form + +A WebGUI::HTMLForm object + +=head3 $object + +An object of this class, used to provide values to the form. It's optional. + +=cut + +sub crud_form { + my ($class, $form, $object) = @_; + my $properties = $class->crud_getProperties; + my $definition = [ { properties => $properties, }]; + $form->dynamicForm($definition, 'properties', $object); +} + +#------------------------------------------------------------------- + =head2 crud_getProperties ( ) A management class method that returns just the 'properties' from the Crud'd definition. diff --git a/lib/WebGUI/PassiveAnalytics/Flow.pm b/lib/WebGUI/PassiveAnalytics/Flow.pm index 5821c285e..1ad5bfb73 100644 --- a/lib/WebGUI/PassiveAnalytics/Flow.pm +++ b/lib/WebGUI/PassiveAnalytics/Flow.pm @@ -277,7 +277,7 @@ sub www_editRule { $form->hidden( name=>"op", value=>"passiveAnalytics"); $form->hidden( name=>"func", value=>"editRuleSave"); $form->hidden( name=>"ruleId", value=>$ruleId); - $form->dynamicForm([WebGUI::PassiveAnalytics::Rule->crud_definition($session)], 'properties', $rule); + $rule->crud_form($form, $rule); $form->submit; my $i18n = WebGUI::International->new($session, 'PassiveAnalytics');