Java Script Disable/Enable Items Problem
101088Feb 23 2005 — edited Feb 25 2005Hi,
I followed the directions to disable/enable items from http://www.oracle.com/technology/products/database/htmldb/howtos/htmldb_javascript_howto2.html#disable.
And I'm getting an error.
I have fields like :
Issue Summary
Issue Description
Identified By
Identified Date
Status (Values: Open, On-Hold, In-Process, Closed)
Priority
Target Resolution Date
Whenever the Status changes to 'In-Process' I would like to disable 'Issue Summary and Issue Description'.
Both the fields (Issue Summary and Issue Description) are being disabled when the Status changed to 'In-Process'
but when I click the 'Apply Changes' button I'm getting the error: 'Issue summary cannot be null.'
I do have a Not Null validation on Issue Summary field, but I'm only updating the Status field.
Following is the JavaScript:
In the Page Attribute (HTML Header)
------------------------------------------------------
<script language="JavaScript" type="text/javascript">
<!--
//htmldb_delete_message='"DELETE_CONFIRM_MSG"';
//-->
// This function takes in:
// 1. A string expression to evaluate. For example:
// 'document.getElementById(\'P125_STATUS\').value=InProcess'
// Notice the quotes are escaped using a "\"
// 2. One or more arguments which are item ID's as strings. For example:
// ...,'P1_ENAME','P1_SAL'...);
// Notice the ID's are the item names, NOT item labels
function disFormItems(testString,P125_ISSUE_SUMMARY,P125_ISSUE_DESCRIPTION){
theTest = eval(testString);
if(theTest){
for(var i=1;i<4;i++){
if (arguments){
disItem = document.getElementById(arguments[i]);
// disItem.style.background = '#cccccc';
disItem.disabled = true;
}
}
}
else{
for(var i=1;i<4;i++){
if (arguments[i]){
disItem = document.getElementById(arguments[i]);
disItem.disabled = false;
// disItem.style.background = '#ffffff';
}
}
}
}
//-->
</script>
In the Footer:
--------------------
<script language="JavaScript1.1" type="text/javascript">
disFormItems('document.getElementById(\'P125_STATUS\').value==\'In-Process\'','P125_ISSUE_SUMMARY','P125_ISSUE_DESCRIPTION');
</script>
In the Status field HTML Form Element Attributes:
-------------------------------------------------------------------------
onChange="javascript:disFormItems('document.getElementById(\'P125_STATUS\').value == \'In-Process\'','P125_ISSUE_SUMMARY','P125_ISSUE_DESCRIPTION');"
Can somebody let me know what's wrong?
Any help is greatly appreciated.
Thanks in advance