Skip to main content
Nintex Community Menu Bar
Solved

Increase height of text area control as each new line starts?

  • June 1, 2018
  • 4 replies
  • 73 views

Forum|alt.badge.img+16

Hi,

 

Is there a scripty/data label way of increasing the height of the text area as each new line is reached?

 

I followed this thread:

 

but the height increases each time a character is entered, which ends up with a huge gap at the bottom of the text area.

Also, the first solution only works if you click outside of the text area, which is pointless, as the user isn't likely to do that.

 

Is there a way to have the text area add a line to the height each time a new line starts?

 

Thanks

Best answer by Albarghouthy

Hi Sharpharp1,


 


I know you can add new line once the user hit Enter using the following script


 


<script>
$(document).on('keyup', 'textarea', function(e) {
if (e.which == 13 || e.keyCode == 13) {
var rowAttr = $(this).attr('rows');
rowAttr = +rowAttr + +1;
$(this).attr('rows', rowAttr);
}});
</script>

Let me know if this helps


 


 


 

4 replies

Albarghouthy
Forum|alt.badge.img+16
  • Scholar
  • Answer
  • June 4, 2018

Hi Sharpharp1,


 


I know you can add new line once the user hit Enter using the following script


 


<script>
$(document).on('keyup', 'textarea', function(e) {
if (e.which == 13 || e.keyCode == 13) {
var rowAttr = $(this).attr('rows');
rowAttr = +rowAttr + +1;
$(this).attr('rows', rowAttr);
}});
</script>

Let me know if this helps


 


 


 


Forum|alt.badge.img+16
  • Author
  • Scout
  • June 5, 2018

Hi Mustafa,

 

Just tried this and it doesn't work.

 

1) Added it to an Expression:

2) Put script tags round your script.

3) On control change, transfer your script.

 

Ran form, nothing happens when press enter


Albarghouthy
Forum|alt.badge.img+16

Hi Sharpharp1,


 


Apologies I tested the script on the browser console and forgot to add some ';'


 


Updated script in my previous reply


 


this should work if you add it as an expression on a datalabel


Forum|alt.badge.img+16
  • Author
  • Scout
  • June 6, 2018

Thanks Mustafa,