ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Change value on field via script


#1

Hello, I’m new here.

How to make field type on frappe.dialog Read-only, but changeable via javascript?

The goal is, I want to make frappe dialog with field type is “Currency” but the field is readonly.

this is my script

 `new frappe.ui.Dialog({
		fields: [{
	                        fieldtype: 'Currency',
			label: __(p.mode_of_payment),
			options: me.frm.doc.currency,
			fieldname: p.mode_of_payment,
			default: p.amount,
			onchange: () => {
					const value = this.dialog.get_value(this.fieldname) || 0;
				  me.update_payment_value(this.fieldname, value);
			},
                    }],
		width: 800,
		invoice_frm: this.frm
	});`