Well, obviously you will need some custom validation on the model, to
identify these problems.  The usual method for this would be to put
some code in the model beforeValidate() callback, and when an error is
found call Model->invalidate( "fieldname" ).

However, this invalidate call doesn't need to be on a model field that
actually exists as a database field - you can put anything you like.
If you have the appropriate tagErrorMsg() calls in your view, you'll
see the appropriate errors appear.

So, in your beforeValidate:

if ( empty($recipe) ){
  $this->invalidate('recipeSupplied');
} else if ( !uniqueRecipe($recipe) ){
  $this->invalidate('recipeUnique');
}

and so on.  In your view:

echo $html->tagErrorMsg('Recipe/recipeSupplied', 'Please provide a
recipe.')
echo $html->tagErrorMsg('Recipe/recipeUnique', 'This recipe has already
been provided, please choose another.')


For other (more advanced) validation methods, there are a couple of
wiki tutorials under "advanced validation".


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to