-- Ian R <[EMAIL PROTECTED]> wrote
(on Friday, 26 September 2008, 11:06 AM -0400):
> Hi there!  I'm trying to make a textarea, dojo-enabled, with a maximum  
> of 500 characters.  Here's what I have:
>
> // creating validator
> $validator = new Zend_Validate_StringLength();
> $validator->setMin(2)
>     ->setMax(5)

Just a note -- this will set a maximum of 5 characters, not 500, as you
state you'd like to have.

>     ->setMessage('Text is too  
> long!',Zend_Validate_StringLength::TOO_LONG);
>
> // create textarea and add validator
> $el = new Zend_Dojo_Form_Element_Textarea("ef_Description");
> $el->setLabel("Describe the Event")
>     ->addValidator($validator);
>
> $this->addElement($el);
>
> Everything else validates, dojo-style, but every other form element is  
> derives from ValidationTextBox.  Some debugging shows that the isValid  
> function, defined in Zend/Validate/StringLength.php, is never being  
> called.
>
> How do I call it?  Is it just a matter of adding onkeydown and onblur  
> events?

No -- Zend_Form validators are only called when the form is submitted;
they do not affect client-side operations.

Everything above looks correct; can you indicate what data passed to the
form does not validate? That will potentially give me a reproduce case.

-- 
Matthew Weier O'Phinney
Software Architect       | [EMAIL PROTECTED]
Zend Framework           | http://framework.zend.com/

Reply via email to