Custom Validation of two filed

I want this whenever i check the box then and then the below filed are appear but that are mandatory also when i unchecked the box it shows error mantadatory filed require but i want when i check the box then the validation are apply on that

uncheck Mandatory for from date and to date in the doctype.
add below custom script to validate from date and to date

CUSTOM SCRIPT to validate from date and to date if is_tempoaray is checked

frappe.ui.form.on("Warehouse", {
    is_temporary:function(frm,cdt,cdn){
    		frm.toggle_reqd(["from_date", "to_date"], (frm.doc.is_temporary == 1 ? 1 : 0));
    	},
});
1 Like

One more question here when the user select from date is 21 oct 2019 and to_date is 22 oct 2019 then the warehouse is hide from them when the to_date is expire,the warehosue is hide from then so how to do that

thank you so much finally its work :grinning:

1 Like