1

I am creating a form and am using HTML::FormHandler. I have a select field similar to the following:

has_field color => (
type => 'Select',
default => 'green',
);

sub options_color {
    return [[ qw(red green blue)]];
}

In my template if I use the following line to render the form this select field renders properly as a drop down list populated with the options I set in the options_color method.

[% form.render %]

However, I would like to render fields individually. I believe I am using the method render_field correctly to render just the color field, but the following line produces nothing in my browser.

[% form.render_field('color') %]

I believe my code matches the documentation, but I am not seeing the behavior that the documentation for HTML::FormHandler describes. Any ideas would be very helpful. Thanks!

killianjackson
  • 115
  • 1
  • 6
  • 1
    color vs. colour typo? – ThisSuitIsBlackNot Sep 21 '16 at 17:51
  • I changed it to color instead of colour in my stack overflow question. In my actual code it is colour everywhere so that is not the issue. – killianjackson Sep 21 '16 at 18:11
  • 1
    Please copy-and-paste the exact code you're using when your post questions here. That way people don't waste time finding bugs in fake code, and you don't have to waste your time responding to their comments. :) (not saying I wasted more than about 5 seconds, just some general advice) – ThisSuitIsBlackNot Sep 21 '16 at 18:23

1 Answers1

0

Solved. Despite the render_field method being documented as the way to render an individual field, I was able to render the color field using the following line:

[% form.field('color').render %]

killianjackson
  • 115
  • 1
  • 6