With client side, you can use javascript to grab the "text" from the
textarea and see how long that is. Something like Mootools (or whatever
framework) would provide:
document.id('mytextarea').get('text').trim().length > 50
Since it's only grabbing text and not any html characters, it will make sure
they have actually typed in 50 or more non-whitespace characters.
For server side, you could use strip_tags() to and get the "text":
trim (strip_tags ($this->data['mytextarea'])) > 50
Hope that helps,
~Philip
On Wed, Jun 8, 2011 at 12:28 PM, Krissy Masters
<[email protected]>wrote:
> How can you prevent tricking validation to pass in a situation when your
> using an HTML editor. Example I have a textarea validation set to required
> /
> not empty / min 50 chars/
> But if a user simply hit enter a few times its actually creating <p></p> in
> the data that will end up being sent so after a few "enters" you have
> enough
> characters to pass validation.
> Has anyone defeated this?
>
> Thanks K
--
http://lonestarlightandsound.com/
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php