From 090fb9f268a018ae2ddab5562203a20a4e55fcc9 2014-12-02 22:26:55 From: Bradley M. Kuhn Date: 2014-12-02 22:26:55 Subject: [PATCH] Larger error message when submitting bad amount. This addition to the Javascript and text ensures a clear message to the user of a Javascript-enabled browser that there is an issue with the amount. Also, it prevents submission of the form until the amount is correct. A user with Javascript disabled can circumvent these validation steps; however, the worst-case scenario is that they make a donation for less than $120 that is categorized in Conservancy's internal system as a Supporter donation, and we'll be adding internal checks to find that. --- diff --git a/www/conservancy/static/supporter-page.js b/www/conservancy/static/supporter-page.js index 2e76d12ca03d484e6098ebaeb7dbb9ee8ea2f512..7593ad830d7698f0307a62ae5bfd9ae1ab0d1c0e 100644 --- a/www/conservancy/static/supporter-page.js +++ b/www/conservancy/static/supporter-page.js @@ -43,12 +43,23 @@ $(document).ready(function() { if (isValid) { input.removeClass("invalid").addClass("valid"); errorElement.removeClass("form-error-show").addClass("form-error"); + $("#form-correction-needed").removeClass("form-error-show").addClass("form-error"); } else { input.removeClass("valid").addClass("invalid"); errorElement.removeClass("form-error").addClass("form-error-show"); } }); + $("#supporter-form-submit").click(function(event){ + var valid = $('#amount').hasClass("valid"); + if (! valid) { + $("#form-correction-needed").removeClass("form-error").addClass("form-error-show") + .css("font-weight", "bold").css("font-size", "150%"); + event.preventDefault(); + } else { + $("#form-correction-needed").removeClass("form-error-show").addClass("form-error"); + } + }); /* Handle toggling of annual/monthly form selections */ $('.supporter-type-selection#monthly').hide(); $('#annualSelector').css("font-weight", "bold").css("font-size", "127%"); diff --git a/www/conservancy/static/supporter/index.html b/www/conservancy/static/supporter/index.html index e90166745f315562da69d853f7a600bdc02b9399..f62fd1ef565fdbb934db6c7a16ed44e939f8b5c8 100644 --- a/www/conservancy/static/supporter/index.html +++ b/www/conservancy/static/supporter/index.html @@ -234,6 +234,7 @@ internal policies are published and available for scrutiny.

options to the right first. +Please ensure all form data above is correct. {% endblock %}