-- Ian Rickert <[EMAIL PROTECTED]> wrote
(on Friday, 26 September 2008, 01:37 PM -0700):
> Bruno Friedmann-2 wrote:
> > If you want to interact with the content of the textarea during the
> > "client phase" you must interact with the browser and this
> > is done by a javascript you could attach on the textarea.
> > 
> > Google is your friend
> > something like this
> > http://www.tutorialstream.com/tutorials/javascript/check-textarea-length/
> > 
> > 
> 
> 
> You'll have to excuse me, but it seems to me that the
> Zend_Dojo_Form_Elements are javascript-based Dijits, intended to validate on
> the client-side.  I can easily (without Google, even) check a textarea's
> length, but I was expecting the functionality of most of the other
> Zend_Dojo_Form_Elements.  From Matthew's response, I'm not sure I'm mistaken
> about that, but am I?

Yes, you are. Not all Dijits have validation available -- that's why,
for instance, there's both TextBox and ValidationTextBox. Textarea has
no validation by default.

Additionally, you'll need to tell the form to validate at the onsubmit
event so that it does client-side validations prior to submitting. This
has been discussed in a previous thread.

> I've been scouring the ZF code and the Dojo API looking for clues as to why
> this would or wouldn't work with a textarea, and I'll spare you the code
> snippets, but it just seems like a (very strange) limitation of Dojo Dijits. 
> There's no validate() function for dijit.form.Textarea the way there is for,
> say, dijit.form.ValidationTextBox or dijit.form.ComboBox.  It is to weep. 
> Kinda doesn't make sense to me, so if it actually does make sense, I'd love
> to know why.

Because Textareas allow for freeform input. Most validation constraints
are meaningless for textareas as a result -- they're too restrictive.

That said, it's simple to attach lambdas to events with Dojo, so you can
certainly do so.

> That having been said, I guess the way to go is to just put some custom
> javascript in the oninit, onblue and onkeypress events of the textarea, like
> Dojo has built in for those other Dijits.  Yes?

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

Reply via email to