Server side scripting doubt

Hi all,
In serverside scripting how to refresh form after save and beform submit.
As I am inserting the data’s from the page to form. I have did some client side scripting in custom script. when i inserting from page to form the custom script is not accessed. but when i am refreshing it from draft mode then custom script works.
My Insertion script:

@frappe.whitelist() 
def essl_insert(employee=None, employee_name=None, attendance_date=None, status=None, in_time=None, out_time=None, day = None):
    employee_val = employee.split(',')
    employee_name_val = employee_name.split(',')
    attendance_date_val = attendance_date.split(',')
    status_val = status.split(',')
    in_time_val = in_time.split(',')
    out_time_val = out_time.split(',')
    day_val = day.split(',')
    i = 0
    for employee_values in employee_val:
        employee = employee_val[i]
        employee_name = employee_name_val[i]
        attendance_date = attendance_date_val[i]
        status = status_val[i]
        in_time = in_time_val[i]
        out_time = out_time_val[i]
        day = day_val[i]
        if employee:
            emp_attendance = frappe.get_doc({
                "doctype":"essl",
                "employee":employee,
                "employee_name":employee_name,
                "attendance_date":attendance_date,
                "status":status,
                "in_time":in_time,
                "out_time":out_time,
                "day":day,
            });
        emp_attendance.insert(ignore_permissions=True);
        #emp_attendance.submit();
        i = i + 1
    frappe.msgprint("ESSL Attendance Inserted")

As custom script function is on save event

Have you written custom script to call your whitelisted function? If yes, maybe you can share the code.

Also, some examples of custom script are available here for your reference.

Hi Thans @Pawan

Yeah i wrote client side scripting. the script is below:

frappe.ui.form.on("essl", "validate", function(frm) {
	var working_hours = cur_frm.doc.working_hours;
	if (working_hours == "9 Hours") {
		var out = "17:00:00";
	} else if (working_hours == "12 Hours") {
		var out = "20:00:00";
	}
	cur_frm.doc.in = "08:00:00";
	cur_frm.doc.out = out;
	cur_frm.refresh_fields();
	var t_in = cur_frm.doc.in;
	var t_out = cur_frm.doc.out;
	var in_time = cur_frm.doc.in_time;
	var out_time = cur_frm.doc.out_time;
	var t1parts = t_in.split(':');
	var t1cm=Number(t1parts[0])*60+Number(t1parts[1]);
	var t2parts = in_time.split(':');
	var t2cm=Number(t2parts[0])*60+Number(t2parts[1]);
	var t3parts = out_time.split(':');
	var t3cm=Number(t3parts[0])*60+Number(t3parts[1]);
	var t4parts = t_out.split(':');
	var t4cm=Number(t4parts[0])*60+Number(t4parts[1]);
	var hour = Math.trunc((t1cm-t2cm)/60);
	var min= Math.trunc((t1cm-t2cm)%60);
	var hour1 = Math.trunc((t2cm-t3cm)/60);
	var min1= Math.trunc((t2cm-t3cm)%60);
	var hour2 = Math.trunc((t4cm-t3cm)/60);
	var min2= Math.trunc((t4cm-t3cm)%60);
	if(hour2 < '0' || min2 < '0'){
		hour2 = Math.abs(hour2);
		min2 = Math.abs(min2);
		var ot = (hour2+':'+min2+':00');
		var ot_app = cur_frm.doc.ot_applicable;
		if(ot_app == "Yes"){
		cur_frm.doc.over_time = ot;
		cur_frm.refresh_fields();
		}else {
			cur_frm.doc.over_time = "00:00:00";
			cur_frm.refresh_fields();
		}
	}else{
		cur_frm.doc.over_time = "00:00:00";
		cur_frm.refresh_fields();
	}
	if(hour1 < '0' || min1 < '0'){
		hour1 = Math.abs(hour1);
		min1 = Math.abs(min1);
		var tot = (hour1+':'+min1+':00');
		cur_frm.doc.total_time = tot;
		cur_frm.refresh_fields();
	}else{
		hour1 = Math.abs(hour1);
		min1 = Math.abs(min1);
		var tot = (hour1+':'+min1+':00');
		cur_frm.doc.total_time = tot;
		cur_frm.refresh_fields();
	}
	if(hour < '0' || min < '0'){
		hour = Math.abs(hour);
		min = Math.abs(min);
		var late = (hour+':'+min+':00');
		cur_frm.doc.late = late;
		cur_frm.refresh_fields();
		cur_frm.doc.early = "00:00:00";
		cur_frm.refresh_fields();
	}else{
		hour = Math.abs(hour);
		min = Math.abs(min);
		var early = (hour+':'+min+':00');
		cur_frm.doc.early = early;
		cur_frm.refresh_fields();
		cur_frm.doc.late = "00:00:00";
		cur_frm.refresh_fields();
	}
	var time = cur_frm.doc.over_time;
	arr = time.split(':');
	hour = $.trim(arr[0]);
	min = $.trim(arr[1]);
	sec = $.trim(arr[2]);
	h_min = parseInt(hour * 60);
	m_min = parseInt(min);
	s_min = parseInt(sec / 60);
	var total_minutes = h_min + m_min + s_min;
	if(total_minutes >= 60){
		cur_frm.doc.over_time_min = total_minutes;
		cur_frm.refresh_fields();
	}else{
		cur_frm.doc.over_time_min = "0";
		cur_frm.refresh_fields();
	}
});

Hi,
We are also use SSL biometric device. kindly explain how to do that integration please explain which location to execute script