Re: [htmltmpl] Dynamic TMPL_VAR names? Is it possible?
Brought to you by:
samtregar
From: Brian M. <bm...@pa...> - 2002-08-13 23:06:16
|
Without knowing how you're using the associate feature, it's hard to come up with a workaround. It seems like loops should work for you, but if whatever youre doing with associate is making that impossible, perhaps you could include the portion of your code where you use associate? Brian ----- Original Message ----- From: "Fran Fabrizio" <fr...@mo...> To: "Cory Trese" <ct...@on...> Cc: <fr...@mo...>; "HTML::Template List" <htm...@li...> Sent: Tuesday, August 13, 2002 3:24 PM Subject: RE: [htmltmpl] Dynamic TMPL_VAR names? Is it possible? | | A loop does me no good. If I have two sites, and I use a loop like | suggested, I get a form that looks something like: | | <form blah...> | <input type=text name=site_name value="foo"> | <input type=text name=site_name value="bar"> | etc.... | | Two form fields in the same form with the same name = broken form. | :-( Even worse, when I go to repopulate the 'associate' feature | has I think now clobbered one of the site_name values and both of | these form fields will get the same data in the value= attribute. | :-( In general, yes, loops are the answer, but when building forms | and/or trying to repopulate forms using the 'associate' feature of | H:T, loops don't work. | | I appreciate the quick response though! Any other ideas? | | -Fran | | >You need a loop. See the HTML::Template docs on LOOPS. | > | ><tmpl_loop name="sites"> | > | ><tmpl_var name="site_id"><br> | ><a href="<tmpl_var name="site_url">"><tmpl_var name="site_name"></a> | > | ></tmpl_loop> | > | >You pass a loop (AKA, "sites => \@sites_array_of_hashref," ) with the | >necessary sites. This loop construction is business-logic (we would | use a | >module that prepared an array of hashrefs from a DBI routine.) | | | | | | | | | | | ------------------------------------------------------- | This sf.net email is sponsored by: Dice - The leading online job board | for high-tech professionals. Search and apply for tech jobs today! | http://seeker.dice.com/seeker.epl?rel_code=31 | _______________________________________________ | Html-template-users mailing list | Htm...@li... | https://lists.sourceforge.net/lists/listinfo/html-template-users | |