I am not sure that will work (I might be wrong) but it seems to me that the model->invalidate is called after your validFunc returning false (this call will oerwrite your message). I haven't tested, neither check the code deeply enough to know if the call to invalidate (into the validateField method) checks for an existing messages prior to call invalidate..
Let me know :-) Thanks On Jun 28, 12:30 am, Geoff Ford <[EMAIL PROTECTED]> wrote: > Oops just reread the question. > > To set the error message from within the ValidFunc you can use the > Model::invalidate($field, $value = null); > > On Jun 28, 8:26 am, Geoff Ford <[EMAIL PROTECTED]> wrote: > > > if believe that you can change the error message with > > var $validate = array( > > 'directory' => array('error_mesasage' => > > array(array('rule' => 'ValidFunc', 'message'=>'message')) > > ); > > > On Jun 28, 5:32 am, francky06l <[EMAIL PROTECTED]> wrote: > > > > I guess you can't do this using the model validation, but if your > > > validation function is in the current model, you could replace the > > > value $this->data['Model']['field'] and return true (in this way, this > > > will not be considered as an error). > > > If your goal is to correct the value, show it with a message, the > > > above is still valid (for the value) but I have no idea how to change > > > the message. You can have a look to the bakery (multiple validation), > > > Mariano has done work about validation messages into the view-side, > > > maybe there you could interact with it. > > > > On Jun 27, 9:11 pm, phpjoy <[EMAIL PROTECTED]> wrote: > > > > > ahoy, > > > > > i have the following validation in a model: > > > > var $validate = array( > > > > 'directory' => array('rule' => 'ValidFunc', > > > > 'message'=>'message') > > > > ); > > > > > function ValidFunc($value) { > > > > $newvalue = 'new' .$value; > > > > $value = $newvalue; > > > > case 1: /*message=1*/ return false; > > > > case 2: /*message=2*/ return false; > > > > } > > > > > there are 2 things i'm struggling to do: > > > > 1) change the validation message from the ValidFunc, > > > > 2) change $value for the form to $newvalue. > > > > > anyone knows how i can do that? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---