Increase string field size on workspace?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
I'm working on a Workspace form and configured a Client Script to add a placeholder text to a multi-line String field (description).
The script works as expected (the text disappears when typing and reappears when cleared also it's not saved), but the field's default height is too small for the placeholder text. Because of this, the text gets cut off, requiring users to either scroll or manually resize the field by dragging the bottom-right corner.
Is there a standard way to ensure the field automatically displays at a height that fits the entire placeholder text without manual resizing?
I tried with the following attributes:
edge_encryption_enabled=true,rows=100I also tried adding this plus code to the client script which i use to populate the field with:
function onLoad() {
// 1. setting up placeholder(this works without any issue):
var placeholderText = getMessage('your_description_placeholder_key');
g_form.setFieldPlaceholder('rich_description', placeholderText);
// 2. finding the field and overwriting the CSS
var control = g_form.getControl('rich_description');
if (control) {
control.style.setProperty('--now-textarea--field-height', '20rem', 'important');
control.style.setProperty('min-height', '320px', 'important');
var parentComponent = control.closest('now-textarea');
if (parentComponent) {
parentComponent.style.setProperty('--now-textarea--field-height', '20rem', 'important');
}
}
}
This is how it looks
This is how big it should be by default without me dragging the field to the correct size.
Any advice or best practices would be greatly appreciated!