From ab327635c48e9a127e22bb44e23da4994ae8c2d6 Mon Sep 17 00:00:00 2001 From: Gemma Leigh Date: Wed, 15 Feb 2017 08:41:04 +0000 Subject: [PATCH 1/5] Add two new classes for form validation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit .form-group-error - to apply a red border to a .form-group .fom-control-error - to apply a red border to a .form-control This removes the need to set a parent ‘.error’ class - at present this is setting both a border to the left of a form-group div and the border on a form control. --- .../sass/elements/forms/_form-validation.scss | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/public/sass/elements/forms/_form-validation.scss b/public/sass/elements/forms/_form-validation.scss index ae1c9ea8a..742d1f8ba 100644 --- a/public/sass/elements/forms/_form-validation.scss +++ b/public/sass/elements/forms/_form-validation.scss @@ -1,19 +1,9 @@ // Form validation // ========================================================================== -// Use error to add a red border to the left of a .form-group -.error { - - // Ensure the .error class is applied to .form-group, otherwise box-sizing(border-box) will need to be used - // @include box-sizing(border-box); +// Use .form-group-error to add a red border to the left of a .form-group +.form-group-error { margin-right: 15px; - - // Form inputs should have a red border - // Add a red border to .form-controls that are direct descendants - > .form-control { - border: 4px solid $error-colour; - } - border-left: 4px solid $error-colour; padding-left: 10px; @@ -21,9 +11,14 @@ border-left: 5px solid $error-colour; padding-left: $gutter-half; } +} +// Use .form-control-error to add a red border to .form-control +.form-control-error { + border: 4px solid $error-colour; } + // Error messages should be red and bold .error-message { @include bold-19; From 7d5b5c2cf9bb0f95ceba323e2c2deef9f9141c16 Mon Sep 17 00:00:00 2001 From: Gemma Leigh Date: Wed, 15 Feb 2017 08:49:48 +0000 Subject: [PATCH 2/5] Use the new .form-group-error class This will apply a red border to the left side of a form-group div --- app/views/examples/example_form_elements.html | 26 +++++++++---------- .../form_error_multiple_show_errors.html | 4 +-- .../form_error_radio_show_errors.html | 2 +- .../snippets/form_file_upload_error.html | 2 +- .../form_inset_radios_show_errors.html | 4 +-- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/app/views/examples/example_form_elements.html b/app/views/examples/example_form_elements.html index 6fa20295c..da1a4a67a 100644 --- a/app/views/examples/example_form_elements.html +++ b/app/views/examples/example_form_elements.html @@ -124,7 +124,7 @@

-
+
-
+
@@ -152,7 +152,7 @@

-
+
@@ -174,7 +174,7 @@

-
+
Date of birth @@ -269,7 +269,7 @@

-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+