MediaWiki:Gadget-FormCheck.js: Difference between revisions
From Tsadra Foundation Advanced Contemplative Scholarships
((by SublimeText.Mediawiker)) |
((by SublimeText.Mediawiker)) Tag: Reverted |
||
Line 4: | Line 4: | ||
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 ' | console.log("All filled, setting status to 'Filled'."); | ||
$('input[name="status"]').val(" | $('input[name="status"]').val("Filled"); | ||
} else { | } else { | ||
console.log("Fields missing... Three-year retreat"); | console.log("Fields missing... Three-year retreat"); | ||
Line 12: | Line 12: | ||
} 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 ' | console.log("All filled, setting status to 'Filled'."); | ||
$('input[name="status"]').val(" | $('input[name="status"]').val("Filled"); | ||
} else { | } else { | ||
console.log("Fields missing... Solitary hermitage"); | console.log("Fields missing... Solitary hermitage"); | ||
Line 22: | Line 22: | ||
} | } | ||
} | } | ||
if( ($('input[name="status"]').val() === 'Submitted') || $('input[name="status"]').val() === ' | if( ($('input[name="status"]').val() === 'Submitted') || $('input[name="status"]').val() === 'Completed' ) { | ||
$('#TfacsSubmission input, #TfacsSubmission select, #TfacsSubmission textarea').not('#TfacsSubmitApplication').prop('disabled', true); | $('#TfacsSubmission input, #TfacsSubmission select, #TfacsSubmission textarea').not('#TfacsSubmitApplication').prop('disabled', true); | ||
} else { | } else { |
Revision as of 09:54, 23 May 2024
$('#TfacsSubmission').ready( function() {
function checkForm() {
$('#TfacsSubmission input, #TfacsSubmission select, #TfacsSubmission textarea').prop('disabled', false);
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 'Filled'.");
$('input[name="status"]').val("Filled");
} else {
console.log("Fields missing... Three-year retreat");
$('input[name="status"]').val("Saved");
}
} 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 'Filled'.");
$('input[name="status"]').val("Filled");
} else {
console.log("Fields missing... Solitary hermitage");
$('input[name="status"]').val("Saved");
}
} else {
console.log("Retreat type not set." + $('select[name="retreattype[]"]').val());
}
}
if( ($('input[name="status"]').val() === 'Submitted') || $('input[name="status"]').val() === 'Completed' ) {
$('#TfacsSubmission input, #TfacsSubmission select, #TfacsSubmission textarea').not('#TfacsSubmitApplication').prop('disabled', true);
} else {
jQuery(document).ready( checkForm() );
$('#TfacsSubmission input, #TfacsSubmission select, #TfacsSubmission textarea').on( "keyup", checkForm() );
}
})