still never found a decent solution for this. i suppose it could be solved
with something like this, but where would i put it?

                foreach($form->validationErrors as &$model)
                {
                        foreach ($model as &$field)
                        {
                                $field = '<wrap>'.$field.'</wrap>';
                        }
                }




horatio wrote:
> 
> 
> 
> i was looking through the helpers and found this in the html helper:
> 
>  * html tags used by this helper.
>  *
>  * @var array
>  */
>       var $tags = array(
>               ..
>               'error' => '<div%s>%s</div>'
>               ..
>       );
> 
> which looks like it would be easy to override, but it turns out this tag
> is
> unused by the error methods. the methods use the generic "tag" instead:
> 
>               'tag' => '<%s%s>%s</%s>',
> 
> does anyone know why $tags['error'] doesn't seem to be used?
> 
> 
> 
> 
> 
> corie wrote:
>> 
>> 
>> I guess you could extend the formHelper and array_merge 'error' =>
>> 'false' into the options and then a $this->error() call after it. You
>> could also throw in the conditional if ($this->isFieldError('field')).
>> 
>> -Corie
>> 
>> On Mar 1, 3:29 pm, horatio <[email protected]> wrote:
>>> thanks corie.
>>>
>>> is there any way you know of to do this globally so i dont have to
>>> repeat
>>> the code so often?
>>>
>>>
>>>
>>> corie wrote:
>>>
>>> > You can change the class 'error-message' to whatever you want by
>>> > setting it in the options array of your $form->input call:
>>>
>>> > $form->input('field', array('error' => array('class' => 'custom-error-
>>> > class')));
>>>
>>> > Or you could take the automatic error out of the input div and put it
>>> > on its own where you have more control:
>>>
>>> > <?php echo $form->input('field', array('error' => false));?>
>>> > <div class="error-message'><?php echo $form->error('field', array
>>> > ('class' => 'nested-div'));?></div>
>>>
>>> > -Corie
>>>
>>> > On Feb 28, 11:15 pm, horatio <[email protected]> wrote:
>>> >> two questions--
>>>
>>> >> the default class returned from error() within the html helper is
>>> >> error-message. how do i override this in my controller?
>>>
>>> >> more importantly, how can i inject some html content inside the error
>>> div
>>> >> after a failed form validation?
>>>
>>> >> right now its:
>>>
>>> >> <div class="error-message">error message here</div>
>>>
>>> >> i would like it to hypothetically be:
>>>
>>> >> <div class="error-message"><div class="nested-div">error message
>>> >> here</div></div>
>>>
>>> >> is this possible sanely?
>>>
>>> >> --
>>> >> View this message in
>>> >>
>>> context:http://www.nabble.com/customizing-error-messages-from-form-helper-tp2...
>>> >> Sent from the CakePHP mailing list archive at Nabble.com.
>>>
>>> --
>>> View this message in
>>> context:http://www.nabble.com/customizing-error-messages-from-form-helper-tp2...
>>> Sent from the CakePHP mailing list archive at Nabble.com.
>> > 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/customizing-error-messages-from-form-helper-tp22269823p22294690.html
> Sent from the CakePHP mailing list archive at Nabble.com.
> 
> 
> > 
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/customizing-error-messages-from-form-helper-tp2403312p2512075.html
Sent from the CakePHP mailing list archive at Nabble.com.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to