Data Certification-Make "Optional comment for checked elements" mandatory for failed elements

Mahesh120
Tera Expert

Hi,

 

I know it may not be a good idea to play around with OOTB functionality.However , would to know if there is a way where I can alert user to fill in "comments" without fail for the failed certification elements.Looked at the different UI Macros and UI Pages but not able to see from it gets controlled.

 

Any thoughts or other means of implementation?

 

--Mahesh.

16 REPLIES 16

Hi @Arpan6 ,

 

I tried this method but no luck, just checking if this solution has worked for you.

 

Thanks,

Hi @Arpan6 ,

 

I tried this method, for some reason the function is not getting called in the UI script. Did you made any other changes aprt from the changes in the UI script?

 

Thanks,

Shantanu

Sachin Gavhane
Giga Guru

I have similar requirement. If checked element is empty then alert should be popup that "user cannot certify empty elements" and for those empty elemets certification should be aborted.

can someone help me for the same?

Pavel_Mikeska
Tera Expert

Hello,

all you have to do is to change UI Macro "cert_task_data_button_row".

 

In the <script> part add this code:

// Function to validate the certification comment
    function validateCertComment() {
        var mandatoryComment = "${gs.getMessage('Please fill in the mandatory comment before failing to certify.')}";
        var commentInput = document.getElementById('cert_comment');
        if (commentInput.value == '' || commentInput.value == commentInput.alt) {
            alert(mandatoryComment);
            return false;
        }
        return true;
    }

Change in the script the button slightly:

<span>
     <image class="pointerhand" src="images/certification_fail.png" id="fail_checked_elements" onclick="if (validateCertComment()) { failCheckedElements() };" title="${JS:gs.getMessage('Fail certification for checked elements')}"/>
</span>

Also the default text for cert_comment element could be changed. Do not forget then to change UI Messages:

<span id="cert_comment_span">
     <input id="cert_comment" class="comment_out" size="40" 
          onkeypress="$('info_2').setStyle({visibility:''});if (event.keyCode == 13) Event.stop(event);"
	  onfocus="commentFocus(this);"
	  onblur="commentBlur(this);"
	  alt="${JS:gs.getMessage('Mandatory comment for checked elements')}"
	  value="${JS:gs.getMessage('Mandatory comment for checked elements')}" 
	  default_value="${JS:gs.getMessage('Mandatory comment for checked elements')}"/>
</span>

 

Please mark my answer as Correct if you find it useful.

Hey @Pavel_Mikeska ,

 

Tried this method but the UI macro seems to be disappeared!