frappe.ui.form.on("Lead", "state", function(frm) {
if(frm.doc.state == "Karnataka")
{
set_field_options("city", ["Bangalore","Mysore"])
}
else if(frm.doc.state == "Maharashtra")
{
set_field_options("city", ["Mumbai","Pune"])
}
else if(frm.doc.state == "")
{
set_field_options("city", ["","Bangalore","Mysore","Mumbai","Pune"])
}
});
Anyway we can make option selected ,
example if(frm.doc.state == "")
I want “Pune” to be selected by default.