[Html-widget] How to get the name of the name of the label.

Karl.Moens at marsh.com Karl.Moens at marsh.com
Fri May 19 14:50:03 CEST 2006





Dear list-members,

I have recently started using HTML::Widget, together with Catalyst and DBIx
and use Template Toolkit as the viewing layer.

CSS is used to give the pages a nice look, but I have now come across a
problem in this respect.

As the label includes within its tags the input field, it is easy to have
the label and the input field shown next to each other. However, the
"errors" span-tags are not within the label tag and therefore do not line
up with the field containing the errors.

So I decided to have a list at the bottom of the page with all the errors,
but unfortunately It shows the (database-) name of the field and not the
label.

I'm using the following Template-Toolkit code:

[%IF result.have_errors %]
<h4>Please, correct the following errors:</h4>
    <ul>[% FOREACH element = result.have_errors %]
            [% FOREACH error = result.errors(element) %]
            <li>
                [% error.name %]: [% error.message %]
            </li>
            [% END %]
    [% END %]</ul>
[%END%]

Someone knows an easy way of getting the label for the element, where all
you have from the element is it's database-name? I noticed that the
"_elements" in the widget-object is an array and therefore not easy to get
access to (unless you iterate through it, but that is not too elegant).

Karl
aka CountZero of PerlMonks







~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This message and any attachments are confidential. If you have received
this message in error please delete it from your system. If you require any
assistance please notify the sender. Thank You.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




More information about the Html-widget mailing list