Sunday, March 1, 2009

AW: customizing error messages from form helper

I guess you could do it via the validation rules in the model.

Anja

-----Ursprüngliche Nachricht-----
Von: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] Im Auftrag von horatio
Gesendet: Sonntag, 1. März 2009 21:29
An: cake-php@googlegroups.com
Betreff: Re: customizing error messages from form helper

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 <bnab...@says.mu> 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-tp22269823p22277541.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 cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: