css: add red border around input fields with validation errors.
The .field_with_errors class is added by Simple Form to <input> fields with validation errors.
This commit is contained in:
@@ -135,13 +135,13 @@ ArtistCommentary.merge_commentaries = function(description, commentary) {
|
|||||||
|
|
||||||
// Update commentary field if it's blank, signal an error if there's a conflict.
|
// Update commentary field if it's blank, signal an error if there's a conflict.
|
||||||
ArtistCommentary.update_field = function($field, value) {
|
ArtistCommentary.update_field = function($field, value) {
|
||||||
$field.removeClass("validation-error");
|
$field.closest(".input").removeClass("field_with_errors");
|
||||||
|
|
||||||
if ($field.val().trim() === "") {
|
if ($field.val().trim() === "") {
|
||||||
$field.val(value);
|
$field.val(value);
|
||||||
return true;
|
return true;
|
||||||
} else if ($field.val().trim() !== value) {
|
} else if ($field.val().trim() !== value) {
|
||||||
$field.addClass("validation-error");
|
$field.closest(".input").addClass("field_with_errors");
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ form.simple_form {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
input.validation-error {
|
&.field_with_errors input {
|
||||||
border: 1px solid var(--form-input-validation-error-border-color);
|
border: 1px solid var(--form-input-validation-error-border-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user