1.City as custom_city (Link)
2.Area as custom_area (link)
Here city is under doctype name Province under this doctype city names are created
For Area i create one doctype name Area under the doctype i linked with city and
each cities may have more than 3 area so created one table in name of Area Name
Even i apply this is not working.
frappe.ui.form.on(‘Customer’, {
custom_city: function(frm) {
frm.set_value(‘customer_area_table’, ); // Clear existing rows
frm.trigger(‘load_area_names’); // Reload areas based on selected city
},
load_area_names: function(frm) {
if (frm.doc.custom_city) {
// Fetch areas based on the selected city
frappe.call({
method: 'frappe.client.get_list',
args: {
doctype: 'Area',
fields: ['area_name'],
filters: {
'city': frm.doc.custom_city
}
},
callback: function(r) {
if (r.message) {
// Add fetched areas to the child table
r.message.forEach(function(area) {
frm.add_child('customer_area_table', {
'area_name': area.area_name,
'city': frm.doc.custom_city
});
});
frm.refresh_field('customer_area_table');
}
}
});
}
}
Dear NCP,
The above two fields Area and city added in Address Doctype but in HTML it only take standard field as default any way to add this field in html.