i have doctype name “test001” with submited doctype. and i create child table name “table” insight. child table has 3 field (a, b, sum) . i want use client script to validate when type in field “a” and “b” will auto caculate and write in field “sum” in child table
frappe.ui.form.on('test001', {
validate: function(frm, cdt, cdn) {
volume_calc(frm, cdt, cdn)
}
});
function volume_calc(frm, cdt, cdn){
var d = locals[cdt][cdn];
if(d.a != null && d.b != null){
frappe.model.set_value(cdt, cdn, "sum", (d.a+d.b));
}
cur_frm.refresh_field("sum");
}
NCP
June 11, 2024, 5:27pm
2
Please check the reference:
Hi @NinYo ,
Please apply it.
frappe.ui.form.on("Appraisal Template - Performance", {
p_rating: function(frm,cdt,cdn) {
var d = locals[cdt][cdn];
frappe.model.set_value(cdt, cdn, 'p_score1', (d.p_rating + d.p_weight));
}
});
// Syntax
frappe.ui.form.on("Child Table Name", {
field_name_for_trigger_to_value_calculate: function(frm,cdt,cdn) {
var d = locals[cdt][cdn];
frappe.model.set_value(cdt, cdn, 'child_table_total_value', (d.child_table_value1 + d.c…
@NCP
Thank you, I did it, but can you give me a link or keyword to the document about this part, I can’t find it on the official document