|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
Zend_Form_Element_Captcha doesn't works as expected !Hello,
I'm trying to create a captcha with Image. It practically works excepts that I see the image and 2 fields ... I'm using ZF 1.8.0 This the generated code : <div class="field"><label for="captcha" class="required">are_you_human</label> <img alt="" src="/share/img/captchas/631567244e675bdf5ec0abbb61b6fe58.png"/><br/> <input type="hidden" name="captcha[id]" value="631567244e675bdf5ec0abbb61b6fe58" helper="formText" id="captcha-id"> <input type="text" name="captcha[input]" id="captcha-input" value="" helper="formText"> <input type="text" name="captcha" id="captcha" value="631567244e675bdf5ec0abbb61b6fe58"></div> As you can see Zend_Form render a third field ... Why ???? And in my Zend_Form class I initialize the element like this $elt = new Zend_Form_Element_Captcha('captcha', array( 'label' => "are_you_human", 'captcha' => array( 'captcha' => 'Image', 'wordLen' => 6, 'timeout' => 300, 'font' => './share/fonts/verdana.ttf', 'imgDir' => './share/img/captchas/', 'imgUrl' => '/share/img/captchas/', ) )); $this->addElement($elt); What I've missed ... It's making me crazy Thank you for you help Regards |
|
|
Re: Zend_Form_Element_Captcha doesn't works as expected !2009/4/27 SŽébastien Cramatte <scramatte@...> $elt = new Zend_Form_Element_Captcha('captcha', array( Maybe there is some particular configuration of decorators that cause this, try with a Dumb captcha and fewer option to see if you get the right inputs. Zend_Form_Element_Captcha uses an internal decorator so if your forms play with decorators it can render in wrong html. -- Giorgio Sironi Piccolo Principe & Ossigeno Scripter http://ossigeno.sourceforge.net |
|
|
Zend Form and Input FilteringWhat'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 |
|
|
Re: Zend Form and Input FilteringMatthew 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? |
|
|
Re: Zend Form and Input Filtering
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. |
|
|
Re: Zend Form and Input FilteringI 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:
|
|
|
Re: Zend Form and Input Filtering
Hmm.. good point. I've gone ahead and done that and works well. Seems
like the NormalizedToLocalized and reverse filters aren't available in
ZF 1.7, so went with the pregReplace.
Is it just me or are forms really flakey? I tried adding a GreaterThan validator in my ini config, but it refused to work. When I access an element ($form->elementName->getValue()) it tells me that I'm using a method on a non-object. I tried adding it programatically and it worked fine. Weird. Here's what I've got: In my form class's init() method: $this->getElement('event_max_per_child')Any idea what I'm doing wrong? Cheers, David Hector Virgen wrote: 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. |
| Free embeddable forum powered by Nabble | Forum Help |