Excellent!

Thank you Marcel, you've been a star; my code now works as expected
and I can get on with developing the other parts of my system now. I
second the call that this level of functionality should be added to
the core - it's so useful. Potentially in time the current validation
class might be able to do all this, but to be honest I find the syntax
for that fiddly at best.

One last question and then I'll leave you alone - is it expected that
I should only get one error message per field? Ideally I'd like to
have all the possible errors displayed, not just one of them. I
suspect that's something to do with the way the errors array is built
up?

On Feb 8, 11:41 am, "mcgordon" <[EMAIL PROTECTED]> wrote:
> contentTag is deprecated in 1.1 and they've taken it out of 1.2
> altogether.  Just stick straight HTML in your helper.  This is what my
> modelErrors function looks like:
>
> function modelErrors()
> {
>         $html =& new HtmlHelper;
>         $models = func_get_args();
>         $list = '';
>         foreach ($models as $model)
>         {
>                 if ( isset($this->validationErrors[$model]) )
>                 {
>                         foreach ( $this->validationErrors[$model] as $field 
> => $errors )
>                         {
>                                 foreach ( $errors as $error )
>                                 {
>                                         $list .= '<li>' . $error . '</li>' . 
> NL;
>                                 }
>                         }
>                 }
>         }
>
>         $output = '';
>         if ( !empty($list) )
>         {
>                 $output = '
>                         <div id="error-report">
>                                 <h4>' . __('The following errors need to be 
> corrected:', true) .
> '</h4>
>                                 <ul>
>                                 ' . $list . '
>                                 </ul>
>                         </div>
>                         ';
>         }
>
>         return $output;
>
> }


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to