MediaWiki:Gadget-FormCheck.js: Difference between revisions

From Tsadra Foundation Advanced Contemplative Scholarships
((by SublimeText.Mediawiker))
Tag: Reverted
((by SublimeText.Mediawiker))
Tag: Reverted
Line 1: Line 1:
$(document).ready(function($) {
$(document).ready(function($) {
     if( $('#TfacsSubmission input[name="status"]').val() === 'Complete') {
     if( $('#TfacsSubmission input[name="status"]').val() === 'Complete') {
         $('#TfacsSubmission input, #TfacsSubmission select, #TfacsSubmission textarea').prop('disabled', true);
         $('#TfacsSubmission input, #TfacsSubmission select, #TfacsSubmission textarea').not('#TfacsSubmitApplication').prop('disabled', true);
     }
     }
});
});

Revision as of 08:27, 20 May 2024

$(document).ready(function($) {
    if( $('#TfacsSubmission input[name="status"]').val() === 'Complete') {
        $('#TfacsSubmission input, #TfacsSubmission select, #TfacsSubmission textarea').not('#TfacsSubmitApplication').prop('disabled', true);
    }
});

$('#TfacsSubmission input, #TfacsSubmission select, #TfacsSubmission textarea').on( "keyup", function() {
    if( $('select[name="retreattype[]"]').val() === 'Three-year retreat') {
        if( $('.MustField, .ThreeMustField').filter(function() { return this.value === ''; }).length === 0 ) {
            console.log("All filled, setting status to 'Complete'.");
            $('input[name="status"]').val("Complete");
        } else {
            console.log("Fields missing..." + $('select[name="retreattype[]"]').val());
        }
    } else if( $('select[name="retreattype[]"]').val() === 'Solitary hermitage') {
        if( $('.MustField, .SolMustField').filter(function() { return this.value === ''; }).length === 0 ) {
            console.log("All filled, setting status to 'Complete'.");
            $('input[name="status"]').val("Complete");
        } else {
            console.log("Fields missing..." + $('select[name="retreattype[]"]').val());
        }
    } else {
        console.log("Retreat type not set." + $('select[name="retreattype[]"]').val());
    }
});