How enable check box automatically on save

Suggest me some code to enable the check box automatically on save…

Try
validate: function(frm){
cur_frm.set_value(“fieldname”, 1);
cur_frm.refresh_field();
}

1 Like

alright,thanks for sharing ur code…By the way can u do another favour
how to enable check box in child table?
i hope that u have an idea about it…

Try

frappe.ui.form.on("Child Table Name", {

	after_save: function(frm, cdt, cdn){
		enable_checkbox(frm, cdt, cdn);
	}
});

var enable_checkbox = function (frm, cdt, cdn) 
{
	frappe.model.set_value(cdt,cdn ,"checkbox_name", 1);
}

Thanks @shahid, I tried ur code, but no response in UI…
child table check box is not enabled…

@perkapz share your code and screenshot of doctype.

try this it’s working

frappe.ui.form.on(‘Doctype’, {
before_save: function(frm, cdt, cdn) {
var d = locals[cdt][cdn];
frm.doc.child table.forEach(function(d) {
d.child field name = 1;

1 Like

its working … thanks fa spending some time to clear my issue…