Custom Script Doubts

Our Custom Script Is running properly in draft mode.
But when Doctype is submitted then custom script is not running properly.
script is for displaying some custom fields and hiding original fields on button click.

Debug your custom script. Or post your code here

frappe.ui.form.on("Bank Guarantee", {
	refresh: function(frm) {
		cur_frm.add_custom_button(('Renew BG'), function() {
			cur_frm.toggle_display("start_date", false);
			cur_frm.toggle_display("new_start_date", true);
			cur_frm.toggle_display("end_date", false);
			cur_frm.toggle_display("new_end_date", true);
		});
	}
});