Sternchen
(Corinna Knapp)
February 16, 2023, 10:48am
1
Hello,
Is it possible to make a disabled field scrollable?
The users are only allowed to read the field, but not to write in it. Which is why it is disabled. However, this prevents them from reading the complete text there.
It doesn't matter how many columns I entered in the SP before. Only these 2 are displayed.
For now it looks like this.
Best regards
Corinna
Hello,
Have you tried setting the field to "Read-Only" in the field properties pane on the right hand side of the designer?
Sternchen
(Corinna Knapp)
February 16, 2023, 11:12am
3
Saldy its the same behaviour and we don´t like the look of this.
Perhaps @Nikita_Kurguzov or @Margo can support with this problem!
Margo
(Margo)
February 17, 2023, 9:31am
5
Hello @Sternchen ,
You can enable scrolling for disabled fields using the CSS:
.fd-form textarea[disabled]{
pointer-events: initial;
}
1 Like
Sternchen
(Corinna Knapp)
February 17, 2023, 12:44pm
7
One more quick question.
Is there a way that the field dynamically adjusts to the size?
Margo
(Margo)
February 20, 2023, 2:52am
8
@Sternchen ,
You are welcome!
Do you mean adjust input height to the text? If so, please see this post:
I have a form using grids and when i show the data using the display mode, the size of the fields dynamically changes to the size of the data in the fields. This is Great!
but, when i hit Edit the fields go back to uniform size and you either have to expand the box manually or use the scroll bar to see all the data. any way to get the fields to show all the data in edit mode just like display mode? here are the examples...
Display mode:
[image]
Same Screen edit mode:
[image]
Sternchen
(Corinna Knapp)
February 20, 2023, 6:44am
9
With the code it now looks like this.
However, it should adapt dynamically to the length of the field.
Here is the code I tried.
var textArea = fd.field('Name').$refs.textarea;
function recalcHeight() {
textArea.style.height = (textArea.scrollHeight > textArea.clientHeight) ? (textArea.scrollHeight) + "px" : "120px";
}
recalcHeight();
$(textArea).keyup(recalcHeight);
Thank you for your help
Margo
(Margo)
February 21, 2023, 4:49am
10
@Sternchen ,
"120px" in the code is the minimum height of the field. If you want the height of the field to always fit the content, try this code:
var textArea = fd.field('Text').$refs.textarea;
function recalcHeight() {
textArea.style.height = '10px'
textArea.style.height = (textArea.scrollHeight > textArea.clientHeight) ? (textArea.scrollHeight + 5) + "px" : (textArea.clientHeight + 5) + "px";
}
recalcHeight();
Sternchen
(Corinna Knapp)
February 21, 2023, 7:10am
11
I tried this code and the textarea now looks like this.
Margo
(Margo)
February 21, 2023, 9:13am
12
@Sternchen ,
Are you changing the text of this field dynamically? If so, you need to add this code inside the function that changes field value.
Hi !
about the disabled field scrollable the code below looks like is not working for a multiline rtf SharePoint field, I'm using PlumSail From 3.8.0, can you help please?
regards
Dear @maurizio.fidanza ,
It's not as easy with rich text, but you can try the following instead of setting it disabled:
fd.spRendered(function () {
checkIFrame();
});
function checkIFrame() {
if($(fd.field('RichText').$el).find('iframe').length == 0) {
window.setTimeout(checkIFrame, 100); /* this checks the iframe every 100 milliseconds*/
} else {
$(fd.field('RichText').$el).find('iframe').attr('style', 'pointer-events: none;');
fd.field('RichText').widgetOptions = { tools: [] };
}
}
Thanks Nikita,
it partially worked but the scrollbar is not working and i can't select del text inside the control.
Dear @maurizio.fidanza ,
You're not setting field as disabled at the same time, right? The scroll bar should be fully usable, but text might not be clickable as it simply prevents all events within the field.
Hi @Nikita_Kurguzov I'm not setting it as disabled.
I'll do some more test using a basic form without any code other the one you gave me and I'll let you know...
Thanks.
Dear @maurizio.fidanza ,
You can also try the following CSS instead:
.fd-form .fd-sp-field-note .fd-editor-overlay {
margin-right: 15px;
}
This works with setting field to a disabled state:
fd.spRendered(() => {
fd.field('RichText').disabled = true;
});