Exchanger13
Exchanger13

Reputation: 337

Custom error style in cakephp

i want to show the login errors in red color with a small icon before it, I mean by errors the validation message just like:

public $validate = array(
    'email' => array(
    'rule'       => 'email',
    'required'   => true,
    'message'   => 'Please enter your email adress'
)
)

i've read that these following lines in css will do it , but acutally it didn't work with me , any ideas ?

.error-message {
    background:url( path/to/img.png ) no-repeat top left;
    padding-left:40px; /* or whatever you need for the image to fit */   
} 

Upvotes: 1

Views: 866

Answers (2)

Pratik Joshi
Pratik Joshi

Reputation: 11693

Use following

div.error-message Instead of .error-message

So use

div.error-message {
    background:url( path/to/img.png ) no-repeat top left;
    padding-left:40px; /* or whatever you need for the image to fit */   
} 

Also

    ' 'rule'       => 'email',`

Is for HTML5 client side validation .So you cant modify it , But you can use serverside validation using cutsom made rule.

Upvotes: 0

r3mmel
r3mmel

Reputation: 656

I think that validation error and setFlash message have id="authMessage" and class="message". Try to inspect the element of validation message in your browser, so you can see what id or class it use.

I hope that it helps you. :)

Upvotes: 1

Related Questions