On Tue, Jan 7, 2014 at 1:41 AM, Adam Witney <awit...@sgul.ac.uk> wrote:
> [% user_time( foo.event_start, '_DT_TIMESTAMP_WITH_ZONE' ) | html %] > > Hi Bill, > > Thanks for your email. I agree that the template seems like a good place > for this, but to give a little extra detail. > > I have a form that is used for both object create and editing. When I edit > an object I have this in my controller: > > $c->stash(formdata => $object); > > and in the template: > > <input name="datefield" type="text" value="[% formdata.datefield.dmy('/') > %]" /> > > But when creating a new object, if the form validation fails I pass the > form data back to the form like so: > > $c->stash( formdata => $c->request->params ); > Have you looked at HTML::FormHandler? I would assume it addresses this. I use something similar and the concept is that you have a field object that knows how to render either from the existing object or from user provided input. -- Bill Moseley mose...@hank.org
_______________________________________________ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/