Skip to Content (Press Enter)
OutSystems.com
Personal Edition
Community
Support
Training
Training
Online Training
Developer Schools
Boot Camps
Certifications
Tech Talks
Documentation
Documentation
Overview
ODC
O11
Forums
Forge
Get Involved
Get Involved
Jobs
Ideas
Members
Mentorship
User Groups
Platform
Platform
ODC
O11
Search in OutSystems
Log in
Get Started
Back to Forums
Macro101
158
Views
2
Comments
Input_SetFocus: It would be great to have it make the cursor appear at end of text.
Question
Right now, if I use Input_SetFocus widget, if there is text already in the field, it makes the cursor appear in the left (beginning) of text. It would be great to have it mimic the browser behavior to have the cursor appear at the end of the text when you click on that field.
I have researched on ways to make the cursor move to the end, but so far, found either complicated ones or ones that don't work in all browsers.
Anyone have an update on that?
Thanks!
António Pereira
Champion
Hi Macro101,
I don't know if I understand what you are trying to do, but to put the cursor at the end of the text (if the input has already text) I found this possible solution:
Add an expression to your screen and set its value to:
"<script type=""text/javascript"">
$('.focusTextEnd').focus(function(){
this.selectionStart = this.selectionEnd = this.value.length;
});
</script>"
Don't forget to set the "Escape Content" property of the expression to
No
and to add the class
focusTextEnd
to the input widget to focus.
Does it help you?
Cheers,
António Pereira
Macro101
Yes! ... but very strange...
First I got it to do something different...
It was highlighting the whole text instead of places the cursor at the end - which is an awesome thing to know as well. I will most certainly need that some day.
Here is what it was doing:
So I kept playing with the expression to see if I could make it work. Eventually I put it back the way it was and it is now working perfectly?
Anyway, thank you so much for your solution. Loved it!
(do you know how to make the whole word highlight?) ;o)
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
See the full guidelines
Loading...