Skip to content

Instantly share code, notes, and snippets.

@kirikintha
Created January 13, 2014 21:04
Show Gist options
  • Save kirikintha/8408127 to your computer and use it in GitHub Desktop.
Save kirikintha/8408127 to your computer and use it in GitHub Desktop.
Bootstrap 3 has-error to error conversion for CakePHP. We cannot change the error class, so use this and you get bootstrap's styling on form errors.
/*
Cake PHP's Form Helper will not allow use to use the has-error class, and wrap
the form elements properly, so we update their CSS to use the .error class.
*/
.error .help-block,
.error .control-label,
.error .radio,
.error .checkbox,
.error .radio-inline,
.error .checkbox-inline {
color: #a94442;
}
.error .form-control {
border-color: #a94442;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
}
.error .form-control:focus {
border-color: #843534;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ce8483;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ce8483;
}
.error .input-group-addon {
color: #a94442;
background-color: #f2dede;
border-color: #a94442;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment