Frappe.model.set_value does not work for field of type HTML

I want to update the value of a field address_html of field type HTML using frappe.model.set_value as shown below.
When I reload, nothing happens. But if I change the field type to Text, I see the expected values (“Address goes here”). Could someone please point me to the right way to do this?

frappe.ui.form.on('Sample', 'onload', function(frm, cdt, cdn) { 
	frappe.call({
		method: 'frappe.client.get',
		args: {
				doctype: 'Address',
                name: frm.doc.address
		},
		callback: function(r) {
			frappe.model.set_value(cdt, cdn,'address_html', "Address Goes Here");
		}
	});

});

Hi @Chude_Osiegbu,

You can set the value to HTML field using following method

$(frm.fields_dict.html_field_name.wrapper).html(html_value)

Please check here how frappe set value to tax break-up (HTML field)

Thanks,
Makarand Bauskar

2 Likes

Thank you @makarand_b.

Regards,

How to set value for html field in child table

Hi @Hafees_Kazhunkil
row=$(cur_frm.fields_dict.child_table_name.grid.add_new_row())
then you can use frappe.model.set_value
e.g. you can refer this example in journal entry.js
var credit_row = frm.fields_dict.accounts.grid.add_new_row();
frappe.model.set_value(credit_row.doctype, credit_row.name, "account", values.credit_account);