Change default Button Name of Dialog Box

I’m want to chnage dialog box name from submit to save. I tried to change using below mentioned code but its not working for me.

d.fields_dict.ht.$wrapper.find('form d [type="submit"]').attr('value', 'Save');

My Current code snippet is:

			let d = new frappe.ui.Dialog({
				'fields': [
					{'fieldname': 'ht', 'fieldtype': 'HTML'},
					{'fieldname': 'Total Applied', 'fieldtype': 'Float', 'read_only':1, 'label':'Total Applied Leave', 'default': total_applied_leaves},
					{'fieldname': 'Fully Paid', 'fieldtype': 'Float', 'read_only':1, 'label':'Total Paid Leave', 'default': parseFloat(data.paidQuota)},
					{'fieldname': 'Partically Paid', 'fieldtype': 'Float', 'read_only':1, 'label':'Total Unpaid Leave', 'default': parseFloat(data.unpaidQuota)}
				],
				
				primary_action: function(){
					d.hide();
					frappe.show_alert(d.get_values());
				}
			});
			d.fields_dict.ht.$wrapper.html('Your leave deduction will be on following bases.');
			d.fields_dict.ht.$wrapper.find('form d [type="submit"]').attr('value', 'Save');
			d.show();

Please help me if anyone knows how to change it.
Thanks in Advance. :slight_smile:

hi
you can try this :slight_smile:

dialog.set_primary_action(__(“Send”), function() {
//custom code here
})

1 Like

thanks. It’s Working For me. :slight_smile:

Pls mark as solution :slight_smile:

Marked. :slight_smile:

Can we do this for report ?

do you know how to change color and alignment of button in dialog box ??

@Owais_Zafar Do yoou have solution for this?

var dialog = new frappe.ui.Dialog({

                title: __("Customer"),

                fields: [

                    {

                        "label" : "Name",

                        "fieldname": "type",

                        "fieldtype": "Data",

                        "reqd": 1,

                        "default": "REFUND",

                        "hidden":1

                    },

                    {

                        "fieldtype": "LongText",

                        "label": __(""),

                        "fieldname": "remark",

                        "default": frm.doc.cancellation_remarks,

                        "reqd": 1

                    },

                    {

                        "fieldtype": "Button",
                        "label": __("CONFIRM"),
                        "fieldname": "fund",
                        "cssClass": "btn-primary"

                    }

                ]

            });

you can add like this

dialog.fields_dict.refund.$input.addClass(“btn-primary”);
dialog.fields_dict.refund.$wrapper.css(“float”,“right”);
dialog.show();

also you can do like this