Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

dojo Script is validating but allowing to save the workitem. How to rectify this.

 Hii,

I had created a validation script in dojo for Enumerationlist(Check list Enumeration). When I select "b" in Arribute of "Testf" then Attribute "Testr" need to become mandotry. I can able to make it as mandatory but when I save the workitem without filling mandotry filed(Testr) it is getting saved. I am not understanding where change the code. Below is my code and when I uncheck "b" then that "*" mark need to go but it is not refreshing automatically. If anyone knows kindly suggest me.


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
dojo.provide("org.organization.Validator");
dojo.require("com.ibm.team.workitem.api.common.Severity");
dojo.require("com.ibm.team.workitem.api.common.Status");
(function() {
var Severity = com.ibm.team.workitem.api.common.Severity;
var Status = com.ibm.team.workitem.api.common.Status;
    dojo.declare("org.organization.Validator", null, {
        validate: function(attribute, workItem, configuration) {
var severity= configuration.getChild("parameters").getStringDefault("severity", Severity.ERROR.name);
        var message= configuration.getChild("parameters").getStringDefault("message", "");
    var selectedValues = workItem.getValue("testf");
    var specify = workItem.getValue("testr");
  
   
if(selectedValues!==null){
if(selectedValues!==undefined){

for (var i=0; i < selectedValues.length; i++) {
console.log("-----###--------"+selectedValues[i].label);
if(selectedValues[i].label!=="b"){
console.log("value  --- 111 "+selectedValues[i].label);


return Status.OK_STATUS;

}else {
if((selectedValues[i].label=="b")&&(specify=="")){
console.log("Entered here2");
            return new Status(Severity.ERROR, message);}
        }

}

       
}    }
  



        }
    });
})();

Thank you,
Regards,
Pavanm



0 votes


Be the first one to answer this question!

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Apr 16 '21, 2:31 a.m.

Question was seen: 327 times

Last updated: Apr 16 '21, 2:31 a.m.

Confirmation Cancel Confirm