Good morning,

I've got a read-only field (from HTML::FormFu::Model::DBIC) which is losing the displayed value after form is submitted. I've tried various combinations of force_default, retain_default, etc but don't seem to be able to get the right configuration.

The yaml snippet currently is:

    elements:
      - type: Label
        name: username
        label: User Name
        force_default: 1
        model_config:
          read_only: 1

When the form is first displayed the username value appears in the 'Label' field. After submitting the form the username field is empty.

The controller action logic is:

sub edit :PathPart('edit') :Args(0) :FormConfig('users/edit') {
    my ($self, $c) = @_;    #, $id

    my $user = $c->model('DBIC::User')->find($c->stash->{userid});

    my $form = $c->stash->{form}; # $self->form;

    ## add additional custom fields to $form; eg (pseudo-code):
    $fieldset = $form->element({
                type        => 'Fieldset',
                nested_name => $section_code,
        });
    $fieldset->element($config_from_db);

    $form->process;

    if ($form->submitted_and_valid) {
        $form->model->update($user);
    } else {
        ## .....
    }

    $c->stash( template => 'users/edit.tt2' );
}

All other fields in the form get saved to the db as expected. Am I doing something wrong in the config or controller action?

Thanks,
Charlie

--
   Ꮚ Charlie Garrison ♊ <garri...@zeta.org.au>

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
〠  http://www.ietf.org/rfc/rfc1855.txt

_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

Reply via email to