Changeset - ccc036d631c2
[Not reviewed]
0 1 0
Ben Sturmfels (bsturmfels) - 1 month ago 2024-05-09 04:10:10
ben@sturm.com.au
Fix JS error
1 file changed with 2 insertions and 1 deletions:
0 comments (0 inline, 0 general)
conservancy/static/js/supporter-page.js
Show inline comments
...
 
@@ -27,29 +27,30 @@ var buildAmountData = function(amountInput) {
 
}
 

	
 
var supportTypeSelector = function(supportTypeHash) {
 
    return $(supportTypeHash + "Selector");
 
};
 

	
 
/* We've sometimes published links that say #renew instead of #renewal.
 
Rewrite that to work as intended. */
 
if (window.location.hash === "#renew") {
 
    window.location.hash = "#renewal";
 
}
 

	
 
var $formCorrectionNeeded = $('#form-correction-needed');
 

	
 
function init_sustainer_form_validation () {
 
    // Forms start in "invalid" form, with the errors shown, so that
 
    // non-Javascript users see the errors by default and know what they must
 
    // enter.  Now we hide those for JavaScript users:
 
    var $formCorrectionNeeded = $('#form-correction-needed');
 
    $formCorrectionNeeded.addClass('hidden');
 

	
 
    $('form.supporter-form').each(function(index, form) {
 
        var $amountInput = $('input[type=number]', form).first();
 
        var $amountError = $('.form-error', $amountInput.parents('.supporter-form-input'));
 

	
 
        $amountError.on(NEW_AMOUNT_EVENT, function(event, amountData) {
 
            var isValid = amountData.newAmount >= amountData.minAmount;
 
            if (amountData.oldAmount === undefined) {
 
                if (isValid) {
 
                    $amountError.addClass('hidden');
 
                } else {
0 comments (0 inline, 0 general)