fuwMove('Date', 'placeholderNFMiscDate', (opts.OptionNFMisc)) ||
fuwMove('Date', 'placeholderDate', true);  
// permission field is shared between ThirdParty and FreeWebsite sections
fuwMove('Permission', 'placeholderFreeWebsitePermission', (opts.OptionFreeWebsite)) ||
fuwMove('Permission', 'placeholderPermission', true);  
// publication field is shared between PDOld, NFPortrait and NFMisc
fuwMove('Publication', 'placeholderNFPortraitPublication', (opts.OptionNFPortrait)) ||
fuwMove('Publication', 'placeholderNFMiscPublication', (opts.OptionNFMisc)) ||
fuwMove('Publication', 'placeholderPublication', true);  
// Purpose, Commercial, Replaceable and ReplaceableText FUR fields are shared
// between some but not all of the non-free sections
fuwMove('NFPurpose', 'placeholderNFExcerptPurpose', (opts.OptionNFExcerpt)) ||
fuwMove('NFPurpose', 'placeholderNFPurpose');
fuwMove('NFCommercial', 'placeholderNFPortraitCommercial', (opts.OptionNFPortrait)) ||
fuwMove('NFCommercial', 'placeholderNFCommercial');
fuwMove('NFReplaceable', 'placeholderNFPortraitReplaceable', (opts.OptionNFPortrait)) ||
fuwMove('NFReplaceable', 'placeholderNFReplaceable');
fuwMove('NFReplaceableText', 'placeholderNFExcerptReplaceable', (opts.OptionNFExcerpt)) ||
fuwMove('NFReplaceableText', 'placeholderNFReplaceableText', true);  
// submit button goes to Step1 if user has chosen a plain overwrite of an existing file,
// and to the active section of Step3 if otherwise
fuwMove('fuwSubmit', 'UploadScriptStep1', (warn.ImageExists && opts.OverwriteSame)) ||
fuwMove('fuwSubmit', 'detailsOwnWork', opts.OptionOwnWork) ||
fuwMove('fuwSubmit', 'detailsThirdParty', opts.OptionThirdParty) ||
fuwMove('fuwSubmit', 'detailsFreeWebsite', opts.OptionFreeWebsite) ||
fuwMove('fuwSubmit', 'detailsPDOld', opts.OptionPDOld) ||
fuwMove('fuwSubmit', 'detailsPDOther', opts.OptionPDOther) ||
fuwMove('fuwSubmit', 'detailsNFSubject', opts.OptionNFSubject) ||
fuwMove('fuwSubmit', 'detailsNF3D', opts.OptionNF3D) ||
fuwMove('fuwSubmit', 'detailsNFExcerpt', opts.OptionNFExcerpt) ||
fuwMove('fuwSubmit', 'detailsNFCover', opts.OptionNFCover) ||
fuwMove('fuwSubmit', 'detailsNFLogo', opts.OptionNFLogo) ||
fuwMove('fuwSubmit', 'detailsNFPortrait', opts.OptionNFPortrait) ||
fuwMove('fuwSubmit', 'fuwSubmitHost', true);  
// Show and hide warnings:  
// filename-related warnings:
fuwSetVisible('warningIllegalChars', warn.IllegalChars);
fuwSetVisible('warningBadFilename', warn.BadFilename);
fuwSetVisible('warningImageOnCommons', warn.ImageOnCommons);
fuwSetVisible('warningImageExists', warn.ImageExists);
fuwMove('warningImageThumb', 'warningImageOnCommons', warn.ImageOnCommons, true) ||
fuwMove('warningImageThumb', 'warningImageExists', true, true);  
// notices related to the top-level options:
fuwSetVisible('warningWhyNotCommons', opts.OptionFree);
fuwSetVisible('warningNF', opts.OptionNonFree);
fuwSetVisible('warningNoGood', opts.OptionNoGood);  
// warnings related to non-free "used in" article
fuwSetVisible('warningNFArticleNotFound', warn.NFArticleNotFound);
fuwSetVisible('warningNFArticleNotMainspace', warn.NFArticleNotMainspace);
fuwSetVisible('warningUserspaceDraft', warn.UserspaceDraft);
fuwSetVisible('warningNFArticleDab', warn.NFArticleDab);
fuwSetVisible('NFArticleOK', warn.NFArticleOK);  
// warnings depending on user status:
if (fuw.userStatus.match(/problem|newbie|notAutoconfirmed/)) {
fuwSetVisible('warningFreeWebsite', opts.OptionFreeWebsite);
fuwSetVisible('warningOwnWork', opts.OptionOwnWork);
fuwSetVisible('warningPDOther', opts.OptionPDOther);
fuwSetVisible('warningNFSubject', opts.OptionNFSubject);
}  
// hide main sections in case of intended plain overwrite:
fuwSetVisible('UploadScriptStep2', !(warn.ImageExists && opts.OverwriteSame));
fuwSetVisible('UploadScriptStep3', !(warn.ImageExists && opts.OverwriteSame));  
// show/hide top-level options
fuwSetVisible('detailsFreeStatus', opts.OptionFree);
fuwSetVisible('sendToCommons', opts.OptionFree);  
// show/hide details sections
fuwSetVisible('detailsNFArticle', opts.OptionNonFree);
fuwSetVisible('detailsNFWorkType', opts.OptionNonFree);
fuwSetVisible('detailsOwnWork', opts.OptionOwnWork);
fuwSetVisible('detailsThirdParty', opts.OptionThirdParty);
fuwSetVisible('detailsFreeWebsite', opts.OptionFreeWebsite);
fuwSetVisible('detailsPDOld', opts.OptionPDOld);
fuwSetVisible('detailsPDOther', opts.OptionPDOther);
fuwSetVisible('detailsNFSubject', opts.OptionNFSubject);
fuwSetVisible('detailsNF3D', opts.OptionNF3D);
fuwSetVisible('detailsNFExcerpt', opts.OptionNFExcerpt);
fuwSetVisible('detailsNFCover', opts.OptionNFCover);
fuwSetVisible('detailsNFLogo', opts.OptionNFLogo);
fuwSetVisible('detailsNFPortrait', opts.OptionNFPortrait);
fuwSetVisible('detailsNFMisc', opts.OptionNFMisc);  
fuwSetVisible('EditSummaryDiv', opts.OverwriteSame || opts.OverwriteDifferent);  
// set enabled/disabled
// It might be useful to adapt this to be more liberal about
// the order of input, at least for experienced users.  
//fuwSetEnabled('Artist3D', opts.PD3D);
//fuwSetEnabled('Country3D', opts.FOP3D);
fuwSetEnabled('ThirdPartyEvidenceLink', opts.ThirdPartyEvidenceOptionLink);
fuwSetEnabled('ThirdPartyOTRSTicket', opts.ThirdPartyEvidenceOptionOTRS);
fuwSetEnabled('NFSubjectPurpose', opts.NFSubjectCheckDiscussed);
fuwSetEnabled('NF3DPurpose', opts.NF3DCheckDiscussed);
fuwSetEnabled('NF3DPermission', opts.NF3DOptionFree);
fuwSetEnabled('USGovLicense', opts.PDOtherUSGov);
fuwSetEnabled('PDOfficialPermission', opts.PDOtherOfficial);
fuwSetEnabled('IneligibleLicense', opts.PDOtherSimple);
fuwSetEnabled('PDOtherPermission', opts.PDOtherOther);
fuwSetEnabled('AnyOther', true);  
// need to re-collect the remaining (non-radiobutton) input into the opts object again,
// preparing for validation:
for (i = 0; i < widgets.length; i++) {
var w = widgets[i];
var type = w.type;  
if (type != "radio") {
var id = w.id;
var active = !w.disabled && fuwIsVisible(w);
if (active) {
var value = ((type == 'checkbox') ? w.checked : w.value);
opts[id] = value;
}
}
};  
// final step of validation: check if input is sufficient for
// setting the submit buttons active
var valid = fuw.validateInput;
var validForCommons = valid && opts.OptionFree && !(opts.OverwriteSame || opts.OverwriteDifferent)
&& !opts.ThirdPartyEvidenceOptionNone;
fuwSetVisible('sendToCommons', opts.OptionFree);
fuwSetEnabled('CommonsButton', validForCommons);
fuwGet('fuwSubmitText').innerHTML = opts.OptionFree ?
("<b>No</b>, I want to upload this file here on this wiki only.
" +
"<small>This way it can be used only on the English Wikipedia. However, somebody " +
"else might still decide to copy it to Commons or use it elsewhere later. If you " +
"do not want your file to be copied to Commons and deleted locally, consider adding " +
".</small>") :
"Upload this file.";
fuwGet('SubmitButton').value = validForCommons ? "Upload locally" : "Upload";
fuwSetEnabled('EditSummary', true);
fuwSetEnabled('SubmitButton', valid && (fuw.userStatus != 'notAutoconfirmed'));
if (fuwTesting) {
fuwSetEnabled('SandboxButton', valid);
}  
// if we're in testing mode, update the Sandbox display fields
// after each input change. In normal mode, collectInput will
// only be needed on submit.
if (fuwTesting) {
fuw.collectInput;
fuw.formatOutput(false);
fuwSetVisible('placeholderTestForm', true);
}
}  
// ============================================================
// methods of the global fuw object
// ============================================================  
// ============================================================
// report validation status of filename information
// ============================================================
// This is called from within fuw.validateInput, i.e. every
// time anything in the whole form is changed. It only reports
// results that have previously been cached in the opts and warn
// objects. The actual checking is done in the event handler
// of the file input boxes.