The record format contains a textarea and a button in a css panel. Prior to exfmt, the textarea field is pre-filled with some text by the RPG program. When it displays on the screen, the textarea has focus and its text is selected. I'm not sure how to unselect the text so the cursor is positioned after the pre-filled text. The intent is for the user to enter additional comments after the pre-filled text.
I tried adding the following js in the textarea onfocus() event, but the text remained selected.
input = this;
if (input.setSelectionRange) {
window.getSelection().removeAllRanges();
}
prefilled text in a textarea
-
- New User
- Posts: 9
- Joined: Tue Sep 10, 2019 10:24 am
- First Name: Michael
- Last Name: Perez
- Company Name: Manhattan Life Insurance
- Contact:
-
- New User
- Posts: 9
- Joined: Tue Sep 10, 2019 10:24 am
- First Name: Michael
- Last Name: Perez
- Company Name: Manhattan Life Insurance
- Contact:
Re: prefilled text in a textarea
One workaround I found is to set the "no focus" property on the format. The user will need to click on the textarea, but the cursor will be positioned at the end of the prefilled text.
-
- Profound User
- Posts: 38
- Joined: Wed Jul 19, 2017 4:54 am
- First Name: Nadine
- Last Name: Gauthier
- Company Name: CAPL
- Country: France
- Contact:
Re: prefilled text in a textarea
You can get the HTML DOM element corresponding to the textArea and then set the selectionStart.
The DOM element should have the same ID as the PUI widget.
So basically
The DOM element should have the same ID as the PUI widget.
So basically
Code: Select all
var txtarea = document.getElementById("the_text_area_id_here");
txtarea.selectionStart = txtarea.selectionEnd;
Who is online
Users browsing this forum: No registered users and 2 guests