RE: [htmltmpl] Generating dynamically named tags
Brought to you by:
samtregar
From: Dan H. <dan...@re...> - 2005-04-20 20:56:02
|
> > > I'm writing a template for use with > > CGI:Application::Plugin::ValidateRM. > > C::A::P::VRM expects every field that requires validation > to have a matching > > field with an "err_" prefix (i.e err_field_name). > > > > My field names are dynamic, e.g. > > > > <tmpl_loop name=application_parameters> > > <input type="Text" name="<tmpl_var name=field_name>" > value="<tmpl_var > > name=field_value> </tmpl_loop> > > > > but I can't figure out the best way to specify the error field. > > Obviously > > > > <tmpl_var name=err_<tmpl_var name=parameter>> > > > > doesn't work > > > > Any ideas appreciated > > > > Generate it in the Perl script instead, in an H::T var named > "err_field_name". In the template just place: <tmpl_var > name=err_field_name> > > HTH, > -- > Offer Kaye Thanks for your reply. I'm not clear how it works. If I have a field called "max_rows", then the parsed template will be <input type="Text" name="max_rows"> value="5> err_max_rows What should happen is that <tmpl_var err_max_rows> will be empty when the template is displayed if there is no error, and will have the error message if there is an error. This isn't done by me - it's done by CGI:Application::Plugin::ValidateRM, DFV and HTML::FillInForm. Thanks Dan |