This ties in to my earlier question regarding converting values that are submitted before placing them in the db.  I figured out how to go about doing this just fine, thanks to the Clarification of add_valid and me realizing my controller wasn&#39;t calling things in the proper order.<br>
<br>But now I&#39;m trying to convert from what is in the db, to a more sane value for humans to read.  I figured out that I need to use $field-&gt;default instead of $form-&gt;add_valid (I think?).<br><br>Here&#39;s what I&#39;m doing:<br>
<br>if ($form-&gt;submitted_and_valid) {<br>  #process it, stuff it in the db<br>} else {<br>  $form-&gt;model-&gt;default_values($c-&gt;model(&#39;DB::Thing&#39;));<br>}<br><br>I&#39;ve been looking through the code for HTML::FormFu, HTML::FormFu::Model, HTML::FormFu::Model::DBIC, Catalyst::Controller::HTML::FormFu, etc.<br>
<br>After that call to $form-&gt;model-&gt;default_values, what happens?  I see that at the end of default values, there is a return $form.  But I don&#39;t see anywhere that is doing $c-&gt;stash-&gt;{&#39;form&#39;} = $whatever.  My guess is I&#39;m just missing where ever that gets done (or it&#39;s some automagical thing).<br>
<br>I ask because in trying to figure out how I should do this, I thought I&#39;d look and see how default_values work.  I thought that it&#39;d be as simple as:<br><br>$form-&gt;model-&gt;default_values($c-&gt;model(&#39;DB::Thing&#39;));<br>
my $converted_form = do_conversion($form);<br>$c-&gt;stash-&gt;{&#39;form&#39;} = $converted_form;<br><br>Or perhaps even:<br>$form-&gt;model-&gt;default_values($c-&gt;model(&#39;DB::Thing&#39;));<br>my $converted_form = do_conversion($c-&gt;stash-&gt;{&#39;form&#39;});<br>
$c-&gt;stash-&gt;{&#39;form&#39;} = $converted_form;<br><br>But neither of those seems to work.  The best I&#39;ve been able to get, no matter what I try, is that the form contains what is in the db pre-conversion, or the form contains a bunch of empty data.  What am I missing?<br>