Textarea form element which is auto expanding?

Is there a way in Wappler to have a <textarea> form element which is auto expanding?

If not is there a hack of sorts to make this happen?

Thanks!

Do you want to have the textarea changing its height when you type text inside it?

HI @Teodor

Yep, so when text wraps to the next line it expands, instead of using a scroll bar with a fixed height.

You’ll have to use some custom javascript for that. A quick google search brings solutions like this:

2 Likes

Ah ok. Will have to play with this. Had a feeling it was not going to be something already available.

Thanks!

HI @Teodor

Where is the best place to put custom javascript in Wappler?

In the layout page header, content page or stick it in a js file in the app directory? or is there another spot I should be adding it?

Thanks!

If you want the script to be available on multiple pages, then it should be placed in the layout page, preferably as link to the JS document that contains the script and well, at the bottom of the layout page.

If you want it to be available on a single page, do the above for the respective page.

2 Likes

@StevenM, I’ve done this without js. Am on holiday right now so no access to the code, but I used a calculation involving my_textarea.value.length() to set a value for dmx-bind:rows…

Or something like that! :sunglasses:

2 Likes