« Return to Thread: Zend_Form_Element_Captcha doesn't works as expected !

Zend Form and Input Filtering

by dmuir :: Rate this Message:

Reply to Author | View in Thread

What's the best way to handle a time or date field?

At the moment, for dates I've added a pregReplace filter to the form
element to swap from dd/mm/yyyy to yyyy-mm-dd.

Then in the view scrip, I have a second filter added to swap from
yyyy-mm-dd to dd/mm/yyyy.

It works, but I'm not really happy with the code. I just noticed the
NormalizedToLocalized and LocalizedToNormalized filters, which I'm
assuming is what I should be using.

Is the cleanest way to deal with this be to create date and time
elements together with their own custom decorators that apply the
NormalizedToLocalized filter on output? I would have thought that this
is such a common use-case that there would already have been something
set up for this?

Cheers,
David

 « Return to Thread: Zend_Form_Element_Captcha doesn't works as expected !