Set TextField Size Using JQuery

I just came to know that there is a way that, we can set the size of a textbox using JQuery but don’t know how, any idea?

Ruchin Sharma

please try cur_frm.set_df_property(“field_name”, “length”, value); in onload or refresh.

Hi @ruchin78! Try also this:

frappe.ui.form.on("Purchase Receipt", "onload", function(frm) {
        frm.get_field('items').grid.editable_fields = [
	{fieldname: 'item_code' ,columns: 1},
	{fieldname: 'qty' ,columns: 1},
        {fieldname: 'rate' ,columns: 1},
	{fieldname: 'amount' ,columns: 1},

@SwitsolAG I tried it, but didn’t work.

You have done this on a child table, what if I need to do it on parent fields.

Ruchin Sharma

I am using below code to set the same, and the interesting part is, it works on console but gives error when I write it in custom script:


Error Message: TypeError: Cannot read property ‘height’ of undefined

Any idea why?

Ruchin Sharma