10 May 2006 09:11
Make 'required' as template variable
Hasanuddin Tamir <hasant <at> gmail.com>
2006-05-10 07:11:44 GMT
2006-05-10 07:11:44 GMT
Hi All,
First of all, I just started using CGI::FB less than a month ago and I learnt
immediately that this module is a must in my toolbox. About two weeks
since I tried it, I found that there is the new version (3.03) and installed it
right away. Its modular and subclassable architecture makes it even more
sophisticated. Thanks for Nathan Winger and all the contributors for this
great piece of (highly resuable) software.
Suprisingly I can't find any archive of this list, neither any information
about where the archive is (sorry for my ignorance if such archive does
exist). So I'm sorry if what following was already discussed and decided.
I had a need to access the 'required' property of a field from the template
file but I couldn't find a simple way to do it. My search took me to the file
CGI/FormBuilder/Template/HTML.pm and loaded it on vim. I then made
some changes locally so I can do this in the template file:
<tmpl_loop fields>
<tmpl_if required><b><tmpl_var label</b><tmpl_else>
<tmpl_var label></tmpl_if>: <tmpl_var field>
</tmpl_loop>
Basically, I added a template variable to access the required property,
so one can use it as above example as well as <tmpl_var required-[field]>.
The patch is included both inline and as an attachment since I'm not sure
which one is the correct way to send patches.
While doing the changes, I was thinking if there's more flexible way to
do this kind of changes without patching but didn't continue to elaborate
(Continue reading)
RSS Feed