Search code examples
validationcakephpstylescakephp-2.0invalidation

How to change style of CakePHP's invalidated fields?


How can I change style on invalidated form fields?

I need that when user submits data on form, and if error occurs, I would like to change background color on invalidated ie. text box to red color, and not to display any error message.

Is it possible to achieve in CakePHP?


Solution

  • Ok, got it.

    Invalidation should be defined in Cotroller like:

    $this->Student->invalidate('email', false, true);
    

    And new style defined like:

    .form-control.form-error {
    background-color:#790F12;
    border:2px red solid;
    color:#fff;
    }
    

    Thank you all anyway.