Custom script before submit

How can I make custom script to handel data before submit?

You can use

frappe.ui.form.on("DocType", "on_submit", function(frm, cdt, cdn) {
   // your code
})
1 Like

You can also use -
frappe.ui.form.on(“Doctype”, “before_submit”, function(frm, cdt, cdn) {
// code
})

4 Likes

Just added alert within this code block, but not working

frappe.ui.form.on(“Test Child”, “before_submit”, function(frm, cdt, cdn) {
alert(‘test’);
return false;
})

1 Like

@balaksara, It worked for me. Can you please check your Doctype name. Also i think, before_submit is only for Parent Doctype not for Child table.

Thanks, Priya

Thanks for your reply. Sorry! It was my bad. It worked for me after enabling isSubmittable.

Thaks, Saravanan