399
edits
Changes
no edit summary
Do NOT use the disabled command as this will cause those fields to be wiped. This is a common mistake in JavaScript coding, where
database updates are involved.
Unfortunately Dropdown list do not allow the attribute ''read-only'', and if we user disable no data will be saved. To get around this user the below JavaScript function, this function can work on ant dropdown list in bxp
<syntaxhighlight lang="javascript">
function fn_DropdownList_ReadOnly( strObjectIdDDL ){
var objDropDownListToLock = document.getElementById(strObjectIdDDL);
if (objDropDownListToLock.value != ''){
var strText = objDropDownListToLock.options[objDropDownListToLock.selectedIndex].text;
var strValue = objDropDownListToLock.value;
objDropDownListToLock.length = 0;
objDropDownListToLock.options[objDropDownListToLock.length] = new Option(strText, strValue);
}
}
</syntaxhighlight>
[[Category:Topic:JavaScript]]
[[Category:Topic:Key Concept]]