简体   繁体   中英

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?

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,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM