How To Validate Chtml::textarea W/o Using Model

this is my text area


<?php echo CHtml::textarea('recloc[]','',array("style"=>"width:200px;resize:none;")); ?>

I need to check all the textarea with the name of ‘recloc[]’ if they were empty.

Thanks guys in advance.

your asking about validation??

if you are using an array then you can write in the rules array, eg.


public function rules()

{

   return array(

            array('recloc','type'=>'array','allowEmpty'=>true),

   );

}

Good afternoon.

I think you can make a custom validation rule and then assign it to the attribute.

For example:




public function rules()

{

     array('yourAttribute', 'checkArrayField'),

...

}


function checkArrayField($attribute, $params)

{

     $arrayData = $this->attribute;


     // Now you check the attribute through a loop. If all elements 

     // are OK then return true but return false.

}




Greetings.