diff --git a/lib/NGCP/Panel/Form.pm b/lib/NGCP/Panel/Form.pm index bb51e7e415..7b9ac49824 100644 --- a/lib/NGCP/Panel/Form.pm +++ b/lib/NGCP/Panel/Form.pm @@ -11,7 +11,10 @@ my %forms = (); sub get { my ($name, $c, $create_new) = @_; my $form; - if(exists $forms{$name} && !$create_new) { + if(exists $forms{$name} + && !($forms{$name}->can('ngcp_no_cache') && $forms{$name}->ngcp_no_cache) + && !$create_new + ) { $form = $forms{$name}; $form->clear(); $form->ctx($c); diff --git a/lib/NGCP/Panel/Form/SubscriberProfile/Profile.pm b/lib/NGCP/Panel/Form/SubscriberProfile/Profile.pm index 824f9725a8..e388d59590 100644 --- a/lib/NGCP/Panel/Form/SubscriberProfile/Profile.pm +++ b/lib/NGCP/Panel/Form/SubscriberProfile/Profile.pm @@ -5,6 +5,10 @@ extends 'HTML::FormHandler'; use HTML::FormHandler::Widget::Block::Bootstrap; +#form has dinamic fields, generated by by field_list, that is not triggered when form is taken from the cache. +#Thus we need to recreate form every time. +has 'ngcp_no_cache' => ( default => '1' ); + has '+widget_wrapper' => ( default => 'Bootstrap' ); has_field 'submitid' => ( type => 'Hidden' ); sub build_render_list {[qw/submitid fields actions/]} @@ -68,8 +72,7 @@ has_block 'actions' => ( render_list => [qw/save/], ); -sub update_fields { -#IMPORTANT! redefined sub update_fields with no super call disable call of the update_field_list and defaults methods +sub field_list { my $self = shift; my $c = $self->ctx; return unless $c;