there are two fields in form namely start time and end time my goal is to calculate time difference in HH:MM format.so how to fetch data from this field and set value in form field.as there are no tutorial that tells how to fetch values of this docField.i m totally novice to Frappe, i don’t have that much knowledge on it. any help is appreciated.
frappe.ui.form.on("Form Name", "on_submit", function(frm) {
var field_one = frm.doc.field_name;
var field_two = frm.doc.field_name;
// your logic here
});
@srajelli thnk u so much for your response. what event should i use if i want this to be calculated as soon as user fill up both end time and start time and if end time is greater than start time. can u please help on this.
endtime:function(frm){
var sd=Date.parse(“2/12/2016”+’ ‘+frm.doc.starttime);
var ed=Date.parse(“2/12/2016”+’ '+frm.doc.endtime);
if(sd>ed)
{
frappe.msgprint(“Start Time Must Be Is Smaller Than EndTime”);
}
}
How can i use this frappe.utils.data.time_diff(string_ed_date, string_st_date) function. can you guide me through this. Can i use this for time difference calculation, if yes then how can i use this ?