« Return to Thread: Zend_Form_Element_Captcha doesn't works as expected !
elements.event_max_per_child.type = "text"
elements.event_max_per_child.options.label = "Max Interviews
Per Child"
elements.event_max_per_child.options.required = true
elements.event_max_per_child.options.filters.int.filter = int
;Adding this one works:
;elements.event_max_per_child.options.validators.notempty.validator =
"NotEmpty"
;I add these and the form dies
;elements.event_max_per_child.options.validators.greaterthan.validator
= "GreaterThan'
;elements.event_max_per_child.options.validators.greaterthan.options.min
= 1$this->getElement('event_max_per_child')
->addValidator('GreaterThan', false, array('min' =>
1));I wouldn't say it's necessary, but it helps promote reuse. Otherwise you'll have to write that conversion in each of your view scripts that uses a date.
-Hector
On Tue, Apr 28, 2009 at 5:49 PM, David Muir <david@...> wrote:
I'm aware of Matthew's articles. My question however was whether or not creating my own decorator is necessary in this case, and also whether the NormalizedToLocalized and vice versa filters are the ones I should be using. The documentation is a wee bit sparse for those particular filters.
David
Hector Virgen wrote:Matthew wrote an excellent blog entry on this exact topic, you should check it out.
-Hector
On Tue, Apr 28, 2009 at 12:49 AM, David Muir <david@...> wrote:
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 !
| Free embeddable forum powered by Nabble | Forum Help |