[html-formfu] Pre-filling forms
Carl Franks
fireartist at gmail.com
Thu Feb 7 22:20:52 GMT 2008
On 31/01/2008, Zbigniew Lukasiak <zzbbyy at gmail.com> wrote:
> On Jan 31, 2008 4:10 PM, Moritz Onken <onken at houseofdesign.de> wrote:
> > you could easily put the params in the default of the form.
>
> Sure - but wouldn't it be a bit different then? Would it work exactly
> the same way with checking the constraints and for example building
> the DateTime object out of several parameters?
So you'd still want constraints to be run, even though submitted() is false?
I think rather than adding yet-another option to formfu
(pretend_its_submitted()?) and making the logic even more complicated,
it'd probably be best to do this on the application-side.
The only reason submitted() would be false and the constraints not
run, is if you've set indicator() to a fieldname that wasn't given.
If you don't set indicator(), the default behaviour is that
submitted() is true if *any* field on the form is present in the
$query.
Now, you only need to check it was a POST, to decide that it's
'really' submitted:
if ( $form->submitted_and_valid && $c->req->method eq 'POST' ) {
$form->save_to_model();
}
Does that give you what you were after?
Carl
More information about the HTML-FormFu
mailing list