Hello all,
When one tabs through a form (specifically, in Firefox), all the text in
a field is automatically selected.
What I'm looking for is a way to put a function (in onFocus perhaps)
that will automatically move to the END of the existing text (a blinking
cursor).
Yes, I've Googled, but cannot seem to locate just what I'm looking for.
I'm not a newbie when it comes to programming, but my forte is Python
and PHP, not Javascript.
Thanks,
Klaus 3 4592
On May 28, 2:57 pm, Klaus Brune <klaus.brune-RemoveT...@gmai l.com>
wrote:
Hello all,
When one tabs through a form (specifically, in Firefox), all the text in
a field is automatically selected.
What I'm looking for is a way to put a function (in onFocus perhaps)
that will automatically move to the END of the existing text (a blinking
cursor).
Yes, I've Googled, but cannot seem to locate just what I'm looking for.
I'm not a newbie when it comes to programming, but my forte is Python
and PHP, not Javascript.
Thanks,
Klaus
Klaus,
just an idea, maybe a bit naive: send to client a LEFT ARROW command
after the select method, which will make the cursor to point at the
end of selection.
Thiago
On May 28, 4:56*pm, Thiago Macedo <thiago.ch...@g mail.comwrote:
On May 28, 2:57 pm, Klaus Brune <klaus.brune-RemoveT...@gmai l.com>
wrote:
Hello all,
When one tabs through a form (specifically, in Firefox), all the text in
* a field is automatically selected.
What I'm looking for is a way to put a function (in onFocus perhaps)
that will automatically move to the END of the existing text (a blinking
cursor).
Yes, I've Googled, but cannot seem to locate just what I'm looking for.
I'm not a newbie when it comes to programming, but my forte is Python
and PHP, not Javascript.
Thanks,
Klaus
Klaus,
just an idea, maybe a bit naive: send to client a LEFT ARROW command
after the select method, which will make the cursor to point at the
end of selection.
Thiago
You may try use selection ranges, something like the following:
function setCaretToEnd(c trl) {
if(ctrl.setSele ctionRange) {
ctrl.setSelecti onRange(ctrl.va lue.length, ctrl.value.leng th);
}
else if (ctrl.createTex tRange) {
var range = ctrl.createText Range();
range.moveStart ('character', ctrl.value.leng th);
range.select();
}
}
Then you can call this onfocus: <input id="test" type="text"
onfocus="setCar etToEnd(this);"/>
HTH
Tom Cole wrote:
On May 28, 4:56 pm, Thiago Macedo <thiago.ch...@g mail.comwrote:
>On May 28, 2:57 pm, Klaus Brune <klaus.brune-RemoveT...@gmai l.com> wrote:
>>Hello all, When one tabs through a form (specifically, in Firefox), all the text in a field is automatically selected. What I'm looking for is a way to put a function (in onFocus perhaps) that will automatically move to the END of the existing text (a blinking cursor). Yes, I've Googled, but cannot seem to locate just what I'm looking for. I'm not a newbie when it comes to programming, but my forte is Python and PHP, not Javascript. Thanks, Klaus
Klaus,
just an idea, maybe a bit naive: send to client a LEFT ARROW command after the select method, which will make the cursor to point at the end of selection.
Thiago
You may try use selection ranges, something like the following:
function setCaretToEnd(c trl) {
if(ctrl.setSele ctionRange) {
ctrl.setSelecti onRange(ctrl.va lue.length, ctrl.value.leng th);
}
else if (ctrl.createTex tRange) {
var range = ctrl.createText Range();
range.moveStart ('character', ctrl.value.leng th);
range.select();
}
}
Then you can call this onfocus: <input id="test" type="text"
onfocus="setCar etToEnd(this);"/>
HTH
Thanks, Thiago
This works -- but only sort of... it works when I enter the field via a
mouse click, but not when tabbing into the field (all the data is still
selected). Any ideas?
Note: this is a company-specific application using Firefox 2.0.0.14
exclusively, so compatibility with other browsers is not an issue.
Note 2: this may seem like a small issue, but it becomes more magnified
when you consider that this form is being used by touch-typists (no
mouse) to enter literally tens of thousands of items per day. So having
to constantly move the cursor to the end of the text to modify the last
one or two characters (in this case, numbers) is becoming a major nuisance.
The full story: The form has two text boxes to contain numbers, a
starting and ending sequence. The idea is that the data entry person
will enter the starting sequence, and when they tab to the next field,
the ending sequence, it will automatically (1) copy the starting
sequence because the numbers are similar, to save typing (which the form
now does in an onBlur event in the starting sequence), and (2) move the
cursor to the end of the field so that all the typist has to do is
backspace once or twice to change the last few digits of the ending
sequence.
The problem I'm having is with the implementation of part 2 above.
Simulating a right-arrow key press upon entry into the field seems like
it should work, but I have not been able to get that working either.
- Klaus This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Kevin Blount |
last post by:
I'm playing with dragable <DIV>s, being inspired by google.com/ig,
where you can move items on the page around and have items you move
over change position if necessary.
I have 3 div's setup, one for each dragable item (boxes about
100x150px), inside another div that sets up a border.
my script is instigated by an onMouseOver event and...
|
by: (Pete Cresswell) |
last post by:
I've got this DoCmd in a fields Change() event so that as the user types, the
underlying table (also visible in another screen...) will be updated in realtime
- instead of waiting for the screen TB closed and explicitly saving the
contents.
Only problem is that each time the DoCmd executes, I lose my insertion point.
Net effect is that...
|
by: anonymous |
last post by:
is there a way to surpress the insertion cursor in a rich
text box? for instance, i might want a RichTextBox to
display some text as a Label would-- readonly, no
insertion cursor though text could still be selected.
help!
|
by: DaveR |
last post by:
Can anybody help me to a)get the user's cursor insertion point (caret)
from a multiline textbox, using client-side script I suppose, and then
b)return the position to VB code behind?
I have tried the following client-side function suggested on this
Google Group (thank you) but I'm not sure what it's doing or how to
return the caret position...
|
by: Woody Splawn |
last post by:
I have a grid with, lets say, 3 fields in it, Debit, Credit and Comments, in
that order. When the user moves to the debit field, if he enters data in
it, I would like for the cursor to skip past the Credit field to the
comments field. I have a ColumnChanging event where I trap to see what
field the user is on. I trap for the user being on...
| |
by: jcrouse |
last post by:
I use the following three subs to click on a label and reposition it at
runtime:
Private Sub lblP1JoyUp_MouseDown(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles lblP1JoyUp.MouseDown
myMouseDown = True
mouseX = Cursor.Position.X - Me.Location.X - (lblP1JoyUp.Width / 2)
|
by: Mehina |
last post by:
i am having a problem regarding the disappearance of the cursor in the DataGrid cell after i change the width of the column on runtime.here is a function which is being called in the Textchanged handler of the embedded Textbox of DataGrid Cell.
Private Sub UpgradeGridColumns()
Dim colText As String
Dim currColumn As DataColumn...
|
by: Jassim Rahma |
last post by:
how can i change the cursor of the textbox to the block style?
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |