Closed Bug 33967 Opened 25 years ago Closed 25 years ago

need ability to control caret position/selection in text fields from javascript

Categories

(Core :: Layout: Form Controls, defect, P1)

defect

Tracking

()

VERIFIED FIXED

People

(Reporter: radha, Assigned: sfraser_bugs)

Details

(Whiteboard: Composer feature work)

Need to be able to control cursor/selections in the urlbar from javascript
Accepting
Status: NEW → ASSIGNED
(making the summary more general)
Summary: Need interfaces to manipulate urlbar from javascript → need ability to control caret position/selection in text fields from javascript
Target Milestone: --- → M16
I have the underlying code working, to set the selection in nsGfxTextControlFrame. But I have no idea how to make this accessible from JavaScript. Any ideas, hyatt?
updating keyword and status whiteboard to reflect that this is a beta 2 feature work bug that the Composer team deems a must fix for beta 2.
Severity: normal → major
Keywords: beta2
Priority: P3 → P1
Whiteboard: Composer feature work
Fix checked in. You can get and set the selection in text widets thusly: var textField = document.getElementById("foobar"); textField.setSelectionRange(0, 12); var selStart = textField.selectionStart; var selEnd = textField.selectionEnd; var textLength = textField.textLength; I also made foo.select() work for inputs and textareas.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Component: Editor → HTML Form Controls
Resolution: --- → FIXED
Keywords: nsbeta2
verified in 5/9 build.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.