Textarea in our forms? Who has never used it? No one !

And the famous question that arrives thereafter “Yes, but when you enter a very long text, we would like the area to expand … it would be much more beautiful!”

To avoid this kind of scene, we have a simple answer to propose to you. It’s a JavaScript library called

autosize

that allows you to have self-expanding textarea.

This library can be downloaded here: https://github.com/jackmoore/autosize

The easiest way is to download the autosize.js file and drop it on the K2 server, in the K2 smartforms Runtime \ Script directory, create a Common directory and drop the library into it.

 

The next step, add this tip of javascript in the forms where you want to have the extensible auto controls:

<script src="../../../Script/Common/autosize.js"></script><script>autosize($('textarea'));</script>
Javascript code

 

That’s it, your textarea are now spreading by themselves!

Before After
How to have self expanding textaera in our K2 forms How to have self expanding textaera in our K2 forms

 

It’s your turn  😉

Leave a Reply

Your email address will not be published. Required fields are marked *