how can i make only one print message? tnx in advance
it works, but the checkbox is checked…
what do you mean?
frappe.ui.form.on(“Disposed Item”, {
check(frm){
for(var a=0, len1=frm.doc.items.length; a < len1;a++){
if(frm.doc.items[a].qty1 == frm.doc.items[a].qty){
continue;
}
else{
frappe.msgprint("Some Items are not equal to your Witdrawal");
break;
}
}
}
});
this is my code
up ???
Since you are looping within for loop, it will print you multiple messages. The only option to print a single message is by introducing a flag and moving the msgprint outside for loop.
var flag = 0;
for(var a=0, len1=frm.doc.items.length; a < len1;a++){
if(frm.doc.items[a].qty1 == frm.doc.items[a].qty){
flag = 1;
}
}
if(flag){
frappe.msgprint(“Some Items are not equal to your Witdrawal”);
}
this is my code sir but not working…my trigger is checkbox
frappe.ui.form.on(“Disposed Item”, {
check(frm){
var flag =0;
for(var a=0; a<frm.doc.items.length;a++){
if(frm.doc.items[a].qty1 != frm.doc.items[a].qty){
var flag = 1;
}
}
if(flag){
msgprint('Items are not equal to your Witdrawal ' + 'row #' + frm.doc.items[a].idx + '- '+frm.doc.items[a].item_code );
frm.set_value("check",'');
}
}
});