Search code examples
perltemplate-toolkitdancerhtml-formfu

Using HTML::FormFu, how do you change a field value *after* processing so that it appears modified in Template Toolkit?


For example, if I process a form:

my $form_input = { input_data => '123' };
$form->process($form_input);

Then I want to alter the value of 'input_data':

my $clearme = $form->get_field('input_data');
$clearme->value("546"); # doesn't seem to work

..Before pushing the form object to TT:

template 'index' => { form => $form }; # using Dancer

'input_data' seems to retain it's original value (123). Any hints on what I'm doing wrong, or what I should be doing?

Thanks


Solution

  • After looking at the documentation and doing some testing, I think you want

    $form->add_valid(input_data => '546');