How can I set the height of MultiLinePlainText from the sharepoint list field?

I tried this already, but it is not work.
Display vs Edit field sizes
image
Please help to fix it.

var textArea = fd.field('Message').$refs.textarea;
function recalcHeight() {
textArea.style.height = (textArea.scrollHeight > textArea.clientHeight) ? (textArea.scrollHeight) + "px" : "500px";
}
recalcHeight();
$(textArea).keyup(recalcHeight);

image

Dear @itapps,
Should work, are you wrapping your code inside of fd.spRendered() like in the example? Can you share a screenshot from JS editor?

Yes it is inside the fd.rendered

Your code looks commented out. I have this code working for me in my forms.

Yes I commented out of them because it is not work and makes my other coding not work.
You just think like it is not commented

I would check your browser's console.to see if any errors are appearing.

This is the code I am using in my form:

//This code will dynamically increase/decrease the height of the Multiline text field - [Wizard 3]
 var textArea = fd.field('Reason_For_Difference').$refs.textarea;
    function recalcHeight() {
        textArea.style.height = (textArea.scrollHeight > textArea.clientHeight) ? (textArea.scrollHeight) + "px" : "120px";
    }
 recalcHeight();
 $(textArea).keyup(recalcHeight);

*remember to change the "Reason_For_Difference" field name to your field name.

Dear @itapps,
Try just the code for the textArea, inside of fd.rendered() - remove the rest of the code you have for now.

Dear @Nikita_Kurguzov

I copied the code from @DryChips, it is failed also.


image

fd.rendered(function () {
//
//Test
/
/
var textArea = fd.field('Message').$refs.textarea;
function recalcHeight() {
textArea.style.height = (textArea.scrollHeight > textArea.clientHeight) ? (textArea.scrollHeight) + "px" : "120px";
}
recalcHeight();
$(textArea).keyup(recalcHeight);
})



Please help to fix it.

I tried to consloe.log the textarea
image
And it shows 'undefined'
image
Is that something wrong?

Dear @itapps,
Please, check your app version:
image

And in SharePoint app catalog, check the app package version:

If you don't have the latest versions, please, update or some functionality might not fully work - Update the app package for Plumsail Forms (SharePoint Online) — SharePoint forms

image
it is just 1.8.8
And how can I check the app package version?

Dear @itapps,
You're using SharePoint Online, right? Strange, it should auto-update and the latest version is v2.0.3
You can always download both the app package and the desktop editor from the Plumsail Account - Plumsail Account

To check app package version, you need to open the app catalog in SharePoint Admin Center:

  • Go to More features in the SharePoint admin center, and sign in with an account that has admin permissions for your organization.
  • Under Apps, select Open.


just 1.0.8 App version

Dear @itapps,
The latest version is v1.1.0.0, please, install the latest version following this guide - Update the app package for Plumsail Forms (SharePoint Online) — SharePoint forms

Also, download the latest version of desktop editor from the Plumsail Account

Hi,
I do not know if it is the same in SHP on-prem and online, but do not you need to have the syntax like:
fd.spRendered(function() {
}
I only see "fd.rendered".
Steve

1 Like

Dear @Stepan,
You're correct, it should be inside fd.spRendered(), like this:

fd.spRendered(function(){
    var textArea = fd.field('Message').$refs.textarea;
    function recalcHeight() {
    textArea.style.height = (textArea.scrollHeight > textArea.clientHeight) ? (textArea.scrollHeight) + "px" : "500px";
    }
    recalcHeight();
    $(textArea).keyup(recalcHeight);
});
1 Like