racke / Template-Flute

Template::Flute - Modern designer-friendly HTML templating Engine
Other
11 stars 12 forks source link

allow filters in form fields #108

Closed hexfusion closed 2 years ago

hexfusion commented 9 years ago

It would be nice to be able to do have a filter applied to data passed to form.

$form->fill({ date_time => $dt_object });

# spec
<form name="foo" link="name">
   <field name="date_time" filter="date"/>
</form>

above would be Dancer syntax but you get the idea.

melmothx commented 9 years ago

The thing is going to be quite complicated, because filters are applied at Flute.pm level, while forms comes from the Flute::HTML level and take their own road. Calling ->fill works directly on the XML tree and the Template::Flute::Form knows nothing about the filters. This needs some discussions.

melmothx commented 9 years ago

A solution could be having an internal object which loads the filter and the options at ->new time, and then pass that to the HTML.pm and in turn to the Form. And use that interface at Flute level. But this is obviously not a trivial task.