/**
* Flips the visibility of two DOM Element sets based on a condition
*
* @param {array} cfs_fieldSetShow - List of [column_name]/[HTML element ids] to SHOW when [cfs_ShowCondition] is TRUE.
* @param {array} cfs_fieldSetHide - List of [column_name]/[HTML element ids] to HIDE when [cfs_ShowCondition] is TRUE.
* @param {boolean} cfs_ShowCondition - Toggle condition
*/
function cfs_FlipDOM(cfs_fieldSetShow, cfs_fieldSetHide, cfs_ShowCondition) {
cfs_show = (cfs_ShowCondition) ? 'inline' : 'none';
cfs_hide = (cfs_ShowCondition) ? 'none' : 'inline';
for (var cfs_i = cfs_fieldSetShow.length - 1; cfs_i >= 0; cfs_i--) {
var cfs_Caption = 'caption_' + cfs_fieldSetShow[cfs_i];
var cfs_Prompt = cfs_fieldSetShow[cfs_i] + '_prompt';
var cfs_El = getFormElementDOM(cfs_fieldSetShow[cfs_i]);
var cfs_ElCaption = getFormElementDOM(cfs_Caption);
var cfs_ElPrompt = getFormElementDOM(cfs_Prompt);
try {
cfs_El.style.display = cfs_show;
cfs_ElCaption.style.display = cfs_show;
cfs_ElPrompt.style.display = cfs_show;
} catch (err) { }
}
for (var cfs_i = cfs_fieldSetHide.length - 1; cfs_i >= 0; cfs_i--) {
var cfs_Caption = 'caption_' + cfs_fieldSetHide[cfs_i];
var cfs_Prompt = cfs_fieldSetHide[cfs_i] + '_prompt';
var cfs_El = getFormElementDOM(cfs_fieldSetHide[cfs_i]);
var cfs_ElCaption = getFormElementDOM(cfs_Caption);
var cfs_ElPrompt = getFormElementDOM(cfs_Prompt);
try {
cfs_El.style.display = cfs_hide;
cfs_ElCaption.style.display = cfs_hide;
cfs_ElPrompt.style.display = cfs_hide;
} catch (err) { }
}
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.