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.
This commit is contained in:
parent
b2c18cc59e
commit
090fb9f268
2 changed files with 12 additions and 0 deletions
|
@ -43,12 +43,23 @@ $(document).ready(function() {
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
input.removeClass("invalid").addClass("valid");
|
input.removeClass("invalid").addClass("valid");
|
||||||
errorElement.removeClass("form-error-show").addClass("form-error");
|
errorElement.removeClass("form-error-show").addClass("form-error");
|
||||||
|
$("#form-correction-needed").removeClass("form-error-show").addClass("form-error");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
input.removeClass("valid").addClass("invalid");
|
input.removeClass("valid").addClass("invalid");
|
||||||
errorElement.removeClass("form-error").addClass("form-error-show");
|
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 */
|
/* Handle toggling of annual/monthly form selections */
|
||||||
$('.supporter-type-selection#monthly').hide();
|
$('.supporter-type-selection#monthly').hide();
|
||||||
$('#annualSelector').css("font-weight", "bold").css("font-size", "127%");
|
$('#annualSelector').css("font-weight", "bold").css("font-size", "127%");
|
||||||
|
|
|
@ -234,6 +234,7 @@ internal policies</a> are published and available for scrutiny.</p>
|
||||||
options to the right first.</small>
|
options to the right first.</small>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
<span id="form-correction-needed" class="form-error">Please ensure all form data above is correct.</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in a new issue