Hi Siegfried,

Thanks for helping. I guess I was so fixated with textarea (well I
assumed in was in there for a reason) that I missed looking for
type=textarea. Here is the working syntax anyone else who bumps into
my mistake:

$form->input('body',
                array('type'=>'textarea', 'rows'=>'5',
                        'error' => array(
                                'minLength' => 'The body must have at least 2 
characters',
                                'maxLength' => 'The body must have no more than 
1000 characters'
                        )
                ));

Thanks again - Siegfried!

On May 21, 4:43 am, "Siegfried Hirsch" <[EMAIL PROTECTED]>
wrote:
> This is the way, we use it for a textarea field:
>
>  echo $form->input('body', array('label'=>'Description',
> 'type'=>'textarea', 'rows'=>'15'));
>
> Take a look at the input implementation again, there you find all the
> bells and whistles.
>
> Siegfried
>
> 2007/5/21, DragonI <[EMAIL PROTECTED]>:
>
>
>
> > Hi,
>
> > When I'm trying to use the textarea form helper with validation, it
> > doesn't work - all I get is my page displayed without the form fields
> > being displayed.
>
> > Model:
> >         var $validate =
> >                 array(
> >                         'title' =>
> >                         array (
> >                                 'minLength' => array( 'rule' => 
> > array('minLength', 2) ),
> >                                 'maxLength' => array( 'rule' => 
> > array('maxLength', 50) )
> >                         ),
> >                         'body' => array(
> >                                 'minLength' => array( 'rule' => 
> > array('minLength', 2) ),
> >                                 'maxLength' => array( 'rule' => 
> > array('maxLength', 1000) )
> >                         )
> >                 );
>
> > View:
> >         $form->textarea('body', array('cols'=>'40', 'rows'=>'10') )
>
> > But it works fine when I use form->input, i.e.
> >         $form->input('body',
> >                 array('error' => array(
> >                 'minLength' => 'The comment must have at least 2 
> > characters',
> >                 'maxLength' => 'The comment must have no more than 1000 
> > characters'
> >                 )
> >         ));
>
> > I checked the form helper code but there aren't any options for an
> > error array. Does anyone know of a workaround because I need to set
> > the cols and rows.
>
> > Thanks


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to