A - i already have a routine that *should* to that... but it isn't
working properly. here's the code

function beforeValidate() {
     $validRecords = array();
     foreach ($this->data as $model => $records) {
          foreach ($records as $key => $record) {
               if (is_numeric($key)) {
                    if (array_search(!null, $record)) $validRecords[]
= $record;
               } else break;
               $this->data[$model] = $validRecords;
          }
     }
     return true;
}

B - my saveAll is already overwritten in AppModel and atm it's working
ok. i was just asking if it's possible to do that in a Behavior :)



On 23 Nov, 20:52, Marcelo Andrade <mfandr...@gmail.com> wrote:
> On Mon, Nov 23, 2009 at 12:29 PM, Ernesto <e.fanz...@gmail.com> wrote:
> > (..)
> > A - user can insert just 2 or 3 rows, it's not necesasry to fill all
> > the 10 "Item" rows. saveAll tries to save even empty insertions. Blank
> > rows = validation errors. is there any way to avoid this?
>
> You'll have to loop $this->data and unset the entries when
> you get blank fields.
>
> > B - is it pobbile to create a behavior that forces "validate" =>
> > "first" to every saveAll call?
>
> You can override the saveAll method in your AppModel,
> changing the validate entry in the options to 'first' always.
>
> Best regards.
>
> --
> MARCELO DE F. ANDRADE
> Belem, PA, Amazonia, Brazil
> Linux User #221105

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to