[Solar-talk] Text Area Helper with MaxLength
Rodrigo Moraes
rodrigo.moraes at gmail.com
Thu Sep 27 11:23:19 CDT 2007
On 9/27/07, Kilbride, James P. wrote:
> Any of you know of any text area view helpers that also contain maxlength
> implementations for the text areas? I don't see it in the solar api or zend
> api for the helpers. I'd like a form element helper that will generate any
> Javascript it needs as well to handle the maxlength.
Hey James,
Some time ago I started a series of widget helpers for jQuery - simple
but helpful helpers, that was the idea. :) And although i didn't had a
maxLength one, I would need one shortly and it was simple enough to
forge one for the collection, so here it is:
http://dev.tipos.org/browser/trunk/Tipos/View/Helper/Jquery/TextLimiter.php
As said, it is simple: it takes the 'maxLength' attribute of a
textarea and apply it. To activate, this should be called in a view:
$this->jquery()->textLimiter('#textarea_id');
And that's it.
One drawnback is that my jQuery helpers have some dependencies -
besides the base class and Helper_Jquery, I use my own version of
Helper_Js, which sets inline scripts using external observers instead
of an internal stack.
Anyway, the TextLimiter helper can give you an idea of how simple it
would be to implement one with jQuery. :)
cheers!
-- rodrigo
More information about the Solar-talk
mailing list