Products | Versions |
---|---|
TIBCO MDM | - |
Not Applicable | - |
Out-of-the-box, it is not possible to make the "Reason for rejection" (on "Record Review and Rejection" page) and "Comments" (on "Record Introduction" page) fields mandatory. This can be achieved by using custominit.html. The custominit.html should be placed under the $MQ_COMMON_DIR/<enterprise_short_name>/htmlprops directory.
The following is a sample script, the element IDs may change in future releases:
<SCRIPT id="customInitId" language="JavaScript" type="text/javascript">
function customInit(){
var scrid = document.getElementById("hiddenScreenID").value;
if( scrid == 106 ){
customizeRejectionApprovalScreen();
} else if( scrid == 413 || scrid == 409 || scrid == 408 ){
customizeApprovalScreen();
}
}
function customizeRejectionApprovalScreen(){
jQuery('form:last').submit(function(event){
if( !checkReasonForRejection() ){
if(document.productapproval.action.value != 'cancel'){
document.productapproval.action.value = "";
event.preventDefault();
}
}
});
}
function customizeApprovalScreen(){
jQuery('#btnSubmitImage').bind('click', function(){
if( jQuery('#SubHeaderComment').val().trim().length == 0 ){
alert("Comments field can't be empty.");
event.preventDefault();
} else {
doSubmit('PROCESS');
document.WorkItemForm.submit();
}
});
jQuery('#btnCancelImage').bind('click', function(){
doSubmit('CANCEL');
document.WorkItemForm.submit();
});
jQuery('form:last').submit(function(event){
if( jQuery('#SubHeaderComment').val().trim().length == 0 ){
event.preventDefault();
} else {
document.WorkItemForm.submit();
}
});
}
function checkReasonForRejection(){
var canSubmit = true;
var reasonInput;
jQuery("td[abbr='reject']").each(function(){
var tdObj = this;
jQuery(tdObj).find('input:checked').each(function(){
reasonInput = jQuery(tdObj).next().find('input');
if( reasonInput.val().trim().length == 0 ){
reasonInput.poshytip({content: "Reason can't be empty. Enter the reason for rejection.", showOn
: 'focus', alignTo: 'target', alignX: 'right', alignY: 'center',offsetX: 5})
.poshytip('hide')
.css('border-color','red');
canSubmit = false;
} else {
reasonInput.poshytip('destroy')
.css('border-color','');
}
});
});
if( canSubmit ){
return true;
} else {
reasonInput.trigger("click");
return false;
}
}
</SCRIPT>