From 8c3ecd347abd9d7840c028cc5da953d9fb5df05a Mon Sep 17 00:00:00 2001
From: "Bradley M. Kuhn"
Date: Wed, 3 Dec 2014 20:40:41 -0500
Subject: [PATCH] Return amount to id; add id for error span.
I actually think I want amount to be id rather than a class, now that I
figured out the proper selector to find them all.
Also, the $("span", input.parent()) was buggy if there were any other
span's other than error-related ones in the supporter-form-inputs div.
Finally, ditch that stuff and simply place a font-size reduction
into the CSS for the form-error-show.
---
www/conservancy/static/forms.css | 1 +
www/conservancy/static/supporter-page.js | 6 +++---
www/conservancy/static/supporter/index.html | 12 ++++++------
3 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/www/conservancy/static/forms.css b/www/conservancy/static/forms.css
index 4cca8365..c83935b7 100644
--- a/www/conservancy/static/forms.css
+++ b/www/conservancy/static/forms.css
@@ -25,6 +25,7 @@
.form-error-show {
color: red;
margin-left: 10px;
+ font-size: 75%;
}
input.invalid, textarea.invalid {
diff --git a/www/conservancy/static/supporter-page.js b/www/conservancy/static/supporter-page.js
index 945ef68e..052c21f0 100644
--- a/www/conservancy/static/supporter-page.js
+++ b/www/conservancy/static/supporter-page.js
@@ -44,11 +44,11 @@ $(document).ready(function() {
$("#no_shipping").val("0");
}
});
- $('.amount').addClass("valid");
- $('.amount').on('input', function() {
+ $('*#amount').addClass("valid");
+ $('*#amount').on('input', function() {
var input=$(this);
var value = input.val();
- var errorElement=$("span", input.parent());
+ var errorElement=$("span#error", input.parent());
var noCommaValue = value;
noCommaValue = value.replace(/,/g, "");
var re = /^((\d{1,3}(,?\d{3})*?(\.\d{0,2})?)|\d+(\.\d{0,2})?)$/;
diff --git a/www/conservancy/static/supporter/index.html b/www/conservancy/static/supporter/index.html
index b0edf600..d0d7b91a 100644
--- a/www/conservancy/static/supporter/index.html
+++ b/www/conservancy/static/supporter/index.html
@@ -141,9 +141,9 @@ internal policies are published and available for scrutiny.