[SOLVED] How to tweak Menu / Save button?

Hi guys,

What is the most correct approach to use custom button for saving and some callback?

After inspecting event listeners found:

set_page_actions: function(data) 
(part of the above function)
else {
			var click = {
				"Save": function() {
					me.frm.save('Save', null, this);
				},
				"Submit": function() {
					me.frm.savesubmit(this);
				},
				"Update": function() {
					me.frm.save('Update', null, this);
				},
				"Amend": function() {
					me.frm.amend_doc();
				}
			}[status];

What is the most frappe-wise way to tweak action of the save button (add callback) or to create custom button with frm.save?

Ok, so the best solution for the moment is to use

set_primary_action()

Example (button added on page load):

frappe.ui.form.on(“ToDo”, “refresh”, function(frm) {
frm.page.set_primary_action(__(“Save & Send this to Google Keep!”), function() {

                frm.save("Save", function(){
                   send_and_save_todo(frm.doc);
             });
   });

});

Please close this topic.

4 Likes