you are better doing

function checkCheese($cheese) {
  if ($cheese !='tilsit') {
    return "Never at the end of the week, sir. Always get it fresh
first thing on Monday.";
  }
  if ($cheese !='caerphilly') {
    return "Ah well, it's been on order for two weeks, sir. I was
expecting it this morning.";
  }
  if ($cheese !='cheddar') {
    return "Well, I'm afraid we don't get much call for it around
these parts";
  }
  return true;
}


tbh you should move your validation into your model file and then using
one of the many built in validation rules or rolling your own
http://book.cakephp.org/view/134/Core-Validation-Rules



On Fri, July 9, 2010 12:55 pm, grigri wrote:
> Your should just be able to return the string...
>
> function checkCheese(tilsit, caerphilly, cheddar) {
>   if (!tilsit) {
>     return "Never at the end of the week, sir. Always get it fresh
> first thing on Monday.";
>   }
>   if (!caerphilly) {
>     return "Ah well, it's been on order for two weeks, sir. I was
> expecting it this morning.";
>   }
>   if (!cheddar) {
>     return "Well, I'm afraid we don't get much call for it around
> these parts";
>   }
>   return true;
> }
>
> hth
> grigri
>
> On Jul 9, 12:12 pm, emanuele <emanuel...@gmail.com> wrote:
>> Hello pals, I ve my own validation method. The method checks three
>> fields.
>> Is there any possibility  to customize the message of error depending on
>> the
>> failure condtions? For istance:
>>
>> function myfunc(a, b, c) {
>> if(!a)
>> set a message for a;
>> elseif(!b) set a message for b;
>> elseif(!c) set a message for c;
>>
>> }
>>
>> thanks in advance
>> --
>> Emanuele Gringeri
>> Computer Engineer
>> University of Pisa
>> Be my mirror, my sword and shield
>
> 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
>
>


-- 
Mike Karthauser
Managing Director - Brightstorm Ltd

Email: mi...@brightstorm.co.uk
Web: http://www.brightstorm.co.uk
Tel:  07939 252144 (mobile)
Fax: 0870 1320560

Address: 1 Brewery Court, North Street, Bristol, BS3 1JS

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