I am trying to validate Country and State models from there related models $belongsTo In the form users select Country and State which is populated from the db. So each has an id... Now I want to make sure someone is not messing with the values with Firebug.
So in my Experience controller this is the debug($this->data); right before the save(); Array ( [Experience] => Array ( [company] => Sants Workshop [position] => Head Elf [city] => Secret [state_id] => 31 [country_id] => 3 [respons] => 2222 [start] => 2055 [finished] => 0000 ) ) So I change a State value to ABCD which is not in the DB as an ID.... Array ( [Experience] => Array ( [company] => Sants Workshop [position] => Head Elf [city] => Secret [state_id] => ABCD [country_id] => 3 [respons] => 2222 [start] => 2055 [finished] => 0000 ) ) State Model: function checkStateValues($data) { $valid = false; if (!empty($this->data)) { $san = new Sanitize(); $this->data = $san->paranoid($this->data); $results = array_diff($this->data, $this->find('list', array('fields' => 'id', 'order' => 'id ASC'))); if (empty($results)) $valid = true; } return $valid; } Do I need to set both State and Country to their models? I have in the controller: $black = array('id', 'user_id'); if ($this->Experience->save($this->data, true, array_diff(array_keys($this->Experience->schema()), $black))) { So it should be checking validation before save with 'true' no? Or does it only validate the Experience Model? Thanks Dave --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---