0

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

jbobbylopez
  • 257
  • 2
  • 6
  • 15

1 Answers1

2

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

$form->add_valid(input_data => '546');
ikegami
  • 367,544
  • 15
  • 269
  • 518
  • 1
    huzzah, ikegami wins this round. $form->add_valid() is the way to go. The naming convention in HTML::FormFu always throws me off :( I've been looking for something along the lines of "clear", "reset", "delete", "unset" or just "value".. never would I think "add_valid" would allow me to *change* the value of an existing element. – jbobbylopez Jan 10 '12 at 15:42