Unable to resize a HTML field in service catalog?

srirampappagudi
Tera Expert

Hi All,

I am trying to resize a HTML Field in service catalog when the values are getting added in a table so that I do not need to scroll the values.

var html1 = g_form.getControl('comments');
html1.style.height = (textarea.scrollHeight) + "px";
OR
g_form.getControl('src_cg_bu_data_table_approval').style.height = '200px';

OR

g_form.getControl('src_cg_bu_data_table_approval').setAttribute('style.height', '200px');

I tried all the above from the communities but everything throws a client script error as shown below.

js_includes_sp.jsx?v=05-06-2019_1040&lp=Thu_Jul_04_12_03_20_PDT_2019&c=8_153:67593 (g_env) [SCRIPT:EXEC] Error while running Client Script "BUTableResize": TypeError: Cannot read property 'setAttribute' of null

Is there any UI Script which needs to be enabled to use the Style Attribute?

Please help.

Regards,

Sriram

 

6 REPLIES 6

dianemiro
Kilo Sage

There is an OOB for variable width under Type Specifications in London release:

find_real_file.png

Hi Diane,

 

I want to dynamically resize the HTML field when  the values are added so that the Portal User need not scroll the HTML Field as shown below.

Thank you,

Sriram.find_real_file.png

Try with this code:

var fieldName = 'comments'; //Change with variable name of HTML field
var changeHeight = g_form.getControl(fieldName);
changeHeight.style.height = changeHeight.scrollHeight + '200';

Hi Diane,

 

I get the same error as shown below.

(g_env) [SCRIPT:EXEC] Error while running Client Script "BUTableResize": TypeError: Cannot read property 'style' of null
(anonymous) @ js_includes_sp.jsx?v=05-06-2019_1040&lp=Thu_Jul_04_12_03_20_PDT_2019&c=8_153:67593
js_includes_sp.jsx?v=05-06-2019_1040&lp=Thu_Jul_04_12_03_20_PDT_2019&c=8_153:32589 snPresence response time 809ms
2js_includes_sp.jsx?v=05-06-2019_1040&lp=Thu_Jul_04_12_03_20_PDT_2019&c=8_153:67593 (g_env) [SCRIPT:EXEC] Error while running Client Script "BUTableResize": TypeError: Cannot read property 'style' of null
(anonymous) @ js_includes_sp.jsx?v=05-06-2019_1040&lp=Thu_Jul_04_12_03_20_PDT_2019&c=8_153:67593
js_includes_sp.jsx?v=05-06-2019_1040&lp=Thu_Jul_04_12_03_20_PDT_2019&c=8_153:32589 snPresence response time 675ms

 

Regards,

Sriram.