MediaWiki:Gadget-FormCheck.js: Difference between revisions

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

Revision as of 07:05, 20 May 2024

$('#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'.");
            $('select[name="status"]').val("Complete");
        } else {
            console.log("Fields missing...");
        }
    } 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...");
        }
    } else {
        console.log("Retreat type not set." + $('select[name="retreattype[]"]').val());
    }
});