I created a client script for the Doctype form : Promos to calculate a total discount amount.
However, upon enabling this script it won’t change the value. Can someone help how to manipulate form field values?
frappe.ui.form.on('Promos', {
validate: function(frm){
var discount_rate = frm.doc.discount_rate;
var srp = frm.doc.suggested_retail_price_srp;
// Calculate total discount value
var total_discount = srp * (discount_rate / 100);
// Set the calculated value back into the discount_value field
frm.set_value('discount_value', total_discount);
}
})
Okay, what else have you tried? Do console.log statements outside the validate method work?
The more troubleshooting you can do on your own, the more we’ll be able to help you. At the moment, it’s pretty impossible to say anything more than “It works for me”.