Ryan
Ryan

Reputation: 672

HTML::FormHandler How to Render Single Field

Occasionally, I find myself in situations where it would be useful to do something like this:

HTML::FormHandler::Field::Text->new(
        name=>'name',
        label=>'Name',
        value=>'Ryan'
)->render();

There's nothing in the docs I've found that indicate that this shouldn't work. But apparently it doesn't because I get an error saying that the render routine doesn't exist in HTML::FormHandler::Field::Text.

Maybe I'm misunderstanding how widgets get applied and rendered, but I sure wish this or some alternative worked! Sometimes, it doesn't make sense to build up a whole "form" just for one field. Any thoughts?

Upvotes: 1

Views: 85

Answers (1)

user1126070
user1126070

Reputation: 5069

It is called chaining. It is only going to work if method returns $self.

An article about this: http://www.perlmonks.org/?node_id=448444

Regards,

Upvotes: 1

Related Questions