FAQ
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't calling things in the proper order.

But now I'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->default
instead of $form->add_valid (I think?).

Here's what I'm doing:

if ($form->submitted_and_valid) {
#process it, stuff it in the db
} else {
$form->model->default_values($c->model('DB::Thing'));
}

I've been looking through the code for HTML::FormFu, HTML::FormFu::Model,
HTML::FormFu::Model::DBIC, Catalyst::Controller::HTML::FormFu, etc.

After that call to $form->model->default_values, what happens? I see that
at the end of default values, there is a return $form. But I don't see
anywhere that is doing $c->stash->{'form'} = $whatever. My guess is I'm
just missing where ever that gets done (or it's some automagical thing).

I ask because in trying to figure out how I should do this, I thought I'd
look and see how default_values work. I thought that it'd be as simple as:

$form->model->default_values($c->model('DB::Thing'));
my $converted_form = do_conversion($form);
$c->stash->{'form'} = $converted_form;

Or perhaps even:
$form->model->default_values($c->model('DB::Thing'));
my $converted_form = do_conversion($c->stash->{'form'});
$c->stash->{'form'} = $converted_form;

But neither of those seems to work. The best I'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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20090403/825dcb5c/attachment.htm

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 2 | next ›
Discussion Overview
grouphtml-formfu @
categoriesperl, catalyst
postedApr 3, '09 at 6:19p
activeApr 4, '09 at 8:55a
posts2
users2
websitemetacpan.org...

2 users in discussion

Leanan Sidhe: 1 post Carl Franks: 1 post

People

Translate

site design / logo © 2023 Grokbase