TT#48165 Return field_list for profilee form

All forms that use field_list to really generate new fields, based on input, can't be cached.
Now such forms are only
- NGCP::Panel::Form::Preferences
- NGCP::Panel::Form::SubscriberProfile::Profile

Change-Id: I0d5792d17a516b7943a1906c9d497b5a34e713e8
changes/65/26265/2
Irina Peshinskaya 6 years ago
parent a1360159b0
commit 4bac7f0665

@ -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);

@ -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;

Loading…
Cancel
Save