You can use your own validation functions in your model for this:

class Article extends AppModel {

  var $validate = array(
    "name"=>array(
      "rule"=>"myRule",
      "message"=>"you failed myRule!"
    )
  );

  function myRule($data) {

    // $data contains the value of 'name'
    // $this->data contains the rest of the submitted data

    // return true if validation passed otherwise
    // return false

  }

}

see http://book.cakephp.org/view/150/Custom-Validation-Rules for more
concrete examples


On Mar 25, 8:27 pm, gkc <[email protected]> wrote:
> I am trying to find a way to validate certain fields based on whether
> not another field is filled/ selected.
>
> I have a drop down that depending on which item is selected will
> expose other form fields.  I need to validate the fields that are
> exposed for the selected item, and not the others.
>
> Does that make sense?
>
> I dont know if I can do some conditional statements in the model to
> test for which item is selected.
>
> Any help would be greatly appreciated.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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