Qman
(KrustyMan)
1
Hi Plumsail, I have a couple of multiline text fields in my form. I have noticed that the Multiline text field doesn't auto-fit the text in the field.
Here is the outcome:
Is there no way the form can automatically fit the text on load so that the text in that field is more readable?
Dear @Qman,
Please, try the following approach:
function recalcHeight(fieldName) {
var textArea = fd.field(fieldName).$refs.textarea;
textArea.style.height = (textArea.scrollHeight > textArea.clientHeight) ? (textArea.scrollHeight) + "px" : "120px";
}
function returnHeight(fieldName) {
var textArea = fd.field(fieldName).$refs.textarea;
textArea.style.height = "120px";
}
//change PDF button click function
fd.toolbar.buttons[2].click = async function(){
//change height before exportToPDF
recalcHeight("Description");
//set exportToPDF parameters
await fd.exportToPDF('My Document', {
landscape: false,
paperSize : 'A4',
forcePageBreak: '.breaker',
multiPage: false,
margin: '0mm'
});
//return height back after
returnHeight("Description");
}