Re: Getting my validation errors to do like I want

2007-01-15 Thread tracyfloyd


Perfect!
I'm using tagIsInvalid in my view like this:
label ?php if ($html-tagIsInvalid('Contact','firstname')) { echo
'style=color:#99;'; } ? First Name:/label

So that the text color of the labels of any invalid fields is returned
red.

Thanks mikee


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



Re: Getting my validation errors to do like I want

2007-01-15 Thread Mikee Freedom


no probs, enjoy!

On 16/01/07, tracyfloyd [EMAIL PROTECTED] wrote:


Perfect!
I'm using tagIsInvalid in my view like this:
label ?php if ($html-tagIsInvalid('Contact','firstname')) { echo
'style=color:#99;'; } ? First Name:/label

So that the text color of the labels of any invalid fields is returned
red.

Thanks mikee






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



Re: Getting my validation errors to do like I want

2007-01-14 Thread Mikee Freedom


It's still early in the morning here in NZ so my brain has not
switched on completely...

However, I know for sure that the html and form helper have access to
the validation errors list. Check out this function found in the html
helper :

   function tagIsInvalid($model, $field) {
   return empty($this-validationErrors[$model][$field]) ? 0 :
$this-validationErrors[$model][$field];
   }

So, the html helper definitely has access to the list. Also, another
function which may give us a clue :

   function validateErrors() {
   $objects = func_get_args();
   if (!count($objects)) {
   return false;
   }

   $errors = array();
   foreach($objects as $object) {
   $errors = array_merge($errors,
$object-invalidFields($object-data));
   }
   return $this-validationErrors = (count($errors) ? $errors : false);
   }

I would start debugging in your view's on $this-validationErrors, or
access them via the html helper using the handy functions you find in
there (such as tagIsInvalid).

HTH
mikee

On 13/01/07, tracyfloyd [EMAIL PROTECTED] wrote:


I'd like to be able to customize how a form's validation errors are
displayed... i.e. instead of using the tagErrorMsg and having it spit
out a div with a class applied to it for each error message, I'd like
to just make the field label text red and add something like: Please
correct the errors below I can't figure out how to access the
validationErrors in my view, though. I can see them when I run a
print_r on $this in my controller (but of course they aren't in the
viewVars). Any ideas?






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



Getting my validation errors to do like I want

2007-01-12 Thread tracyfloyd

I'd like to be able to customize how a form's validation errors are
displayed... i.e. instead of using the tagErrorMsg and having it spit
out a div with a class applied to it for each error message, I'd like
to just make the field label text red and add something like: Please
correct the errors below I can't figure out how to access the
validationErrors in my view, though. I can see them when I run a
print_r on $this in my controller (but of course they aren't in the
viewVars). Any ideas?


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